Exemplo n.º 1
0
 def test_max_db_term(self):
     numpy.testing.assert_almost_equal( DaviesBouldinCalculator.db_terms_for_cluster(0, [5.0, 6.0, 6.0], self.clusterings[1].clusters, self.matrix),
                          [1.0, 0.7857142857142857], 5)  
     numpy.testing.assert_almost_equal(  DaviesBouldinCalculator.db_terms_for_cluster(1, [5.0, 6.0, 6.0], self.clusterings[1].clusters, self.matrix),
                          [0.7058823529411765], 5)            
     numpy.testing.assert_almost_equal(  DaviesBouldinCalculator.db_terms_for_cluster(2, [5.0, 6.0, 6.0], self.clusterings[1].clusters, self.matrix),
                          [], 5)
Exemplo n.º 2
0
 def test_db_eval(self):
     self.assertAlmostEqual(DaviesBouldinCalculator().evaluate(self.clusterings[1], self.matrix), 0.5686274509803922, 5)
Exemplo n.º 3
0
 def test_calculate_average_distances(self):
     
     self.assertItemsEqual(DaviesBouldinCalculator.calc_average_distances(self.clusterings[0], self.matrix),
                           [7,6])