This Page

In [1]:
import clusim.clugen as clugen
import clusim.sim as sim
from clusim.plotutils import print_clustering
In [2]:
c1 = clugen.make_random_clustering(n_elements = 10, n_clusters = 2)
c2 = clugen.make_random_clustering(n_elements = 10, n_clusters = 5)

print_clustering(c1)
print_clustering(c2)

row_format2 ="{:>25}" * (2)
for simfunc in sim.available_similarity_measures:
    print(row_format2.format(simfunc, eval('sim.' + simfunc+'(c1, c2)')))
01|25|934|86|7
01|26|93|47|5|8
            jaccard_index                     0.25
               rand_index       0.8666666666666667
    fowlkes_mallows_index       0.4082482904638631
    rogers_tanimoto_index       0.7647058823529411
          southwood_index       0.3333333333333333
        czekanowski_index                      0.4
               dice_index                      0.4
           sorensen_index                      0.4
      pearson_correlation    0.0017198248905565979
     classification_error      0.29999999999999993
             purity_index       0.7000000000000001
                 fmeasure                      0.4
                      nmi       0.7744534657094393
                       vi       1.0754887502163468
       geometric_accuracy       0.7483314773547882
          overlap_quality                     -0.0
                     onmi        0.683581142891832
              omega_index       0.3283582089552241