Permalink
Browse files

Merge pull request #24 from lendle/pull-request/b980dd1f

Add runtests.jl and cleanup
  • Loading branch information...
kmsquire committed Jul 8, 2014
2 parents ebb5898 + b980dd1 commit 83ec10693514289efe3eb5fb9445cc04231d8e03
Showing with 20 additions and 6 deletions.
  1. +3 −3 src/affprop.jl
  2. +6 −3 test/dbscan_test.jl
  3. +11 −0 test/runtests.jl
View
@@ -44,7 +44,7 @@ function affinity_propagation{T<:FloatingPoint}(S::Matrix{T}, opts::AffinityProp
exemplars[:, mod(n_iter-1, opts.n_stop_check)+1] = IC
if opts.display == :iter
- @printf("%7d: %3d exemplars identified\n", n_iter, nnz(IC))
+ @printf("%7d: %3d exemplars identified\n", n_iter, countnz(IC))
end
if n_iter > opts.n_stop_check
@@ -91,7 +91,7 @@ function affprop_update_message!{T<:FloatingPoint}(psi::Matrix{T}, phi::Matrix{T
Y = SM[I]
SM[I] = -Inf
Y2 = maximum(SM)
- val = S[i,:] - Y;
+ val = S[i,:] .- Y;
val[I] = S[i,I] - Y2;
phi[i,:] = opts.damp*phi[i,:] + (1-opts.damp)*val
end
@@ -101,7 +101,7 @@ function affprop_update_message!{T<:FloatingPoint}(psi::Matrix{T}, phi::Matrix{T
RP = phi[:,j]
idx = 1:n .!= j
RP[idx] = max(RP[idx], 0)
- val = sum(RP) - RP;
+ val = sum(RP) .- RP;
val[idx] = min(val[idx], 0)
psi[:,j] = opts.damp*psi[:,j] + (1 - opts.damp)*val
end
View
@@ -6,7 +6,8 @@
module dbscan_tester
-include("../src/dbscan.jl")
+using Clustering
+import Clustering: region_query, expand_cluster, DBSCAN
function MakeTestMatrix()
n = 125 # Number of points in the point cloud
@@ -125,12 +126,14 @@ function testDB()
return passed
end
-end # end module
-
test_matrix = MakeTestMatrix()
println ("region_query test: ", testRegionQuery())
println ("expand_cluster test: ", testExpandCluster())
println ("dbscan test: ", testDB())
+end # end module
+
+
+
View
@@ -0,0 +1,11 @@
+testfiles = ["affprop.jl",
+ "dbscan_test.jl",
+ "kmeans.jl",
+ "kmedoids.jl",
+ "sil.jl"]
+
+for fname in testfiles
+ println("Running $fname...")
+ include(fname)
+end
+

0 comments on commit 83ec106

Please sign in to comment.