Skip to content

Commit

Permalink
silhouettes check
Browse files Browse the repository at this point in the history
  • Loading branch information
jaksle committed Nov 28, 2023
1 parent ca4669e commit 146eed4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/clustering_quality.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ using Clustering, Distances
@test clustering_quality(Y', C', W; quality_index = :xie_beni, fuzziness = 2, metric = Euclidean()) 1/3
@test clustering_quality(Y', C', W2; quality_index = :xie_beni, fuzziness = 2, metric = Euclidean()) (14+sqrt(17)) / (12 * 4)

@test clustering_quality(Y', A; quality_index = :dunn, metric = Euclidean()) 1/2
@test clustering_quality(Y', A; quality_index = :silhouettes, metric = Euclidean())
1 - 1/12*( # average over silhouettes 1 - a_i * 1/b_i
+ 4 * 16 /(3+2sqrt(17)+5) # 4 points in clusters 1 and 3
+ 4 * (2sqrt(2)+2)/3 * 1/4 # 4 points in clusters 2 and 4, top + bottom
+ 2 * (2sqrt(2)+2)/3 * 4/(4+2sqrt(26)+6) # 2 points clusters 2 and 4, left and right
+ 2 * (2sqrt(2)+2)/3 * 4/(2+2sqrt(10)+4) # 2 points clusters 2 and 4, center
)

end

@testset "alternate arguments" begin
Expand Down

0 comments on commit 146eed4

Please sign in to comment.