Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add runtests.jl and cleanup #24

Merged
merged 3 commits into from

2 participants

@lendle

Fixes #16, should fix #21 if PackageEvaluator agrees.

@kmsquire
Owner

Thanks! Sorry this took so long to merge.

@kmsquire kmsquire merged commit 83ec106 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 17, 2014
  1. @lendle
  2. @lendle

    Get dbscan tests to run

    lendle authored
  3. @lendle

    add runtests.jl

    lendle authored
This page is out of date. Refresh to see the latest.
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
6 src/affprop.jl
@@ -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
9 test/dbscan_test.jl
@@ -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,8 +126,6 @@ function testDB()
return passed
end
-end # end module
-
test_matrix = MakeTestMatrix()
println ("region_query test: ", testRegionQuery())
@@ -134,3 +133,7 @@ println ("expand_cluster test: ", testExpandCluster())
println ("dbscan test: ", testDB())
+end # end module
+
+
+
View
11 test/runtests.jl
@@ -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
+
Something went wrong with that request. Please try again.