Exemple #1
0
    def templateKmeansPlusPlusForKmedoidsClustering(self, path_sample, amount, expected_clusters_length):
        result_success = True
        for _ in range(3):
            try:
                sample = read_sample(path_sample)
                start_medoids = kmeans_plusplus_initializer(sample, amount).initialize(return_index=True)
                kmedoids_test_template.templateLengthProcessData(path_sample, start_medoids, expected_clusters_length,
                                                              False)

            except AssertionError:
                continue
            break

        assert result_success is True;
 def testClusterAllocationSampleSimple3ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE3, [4, 12, 25, 37], [10, 10, 10, 30],
         True)
 def testClusterOneAllocationSampleSimple2DistanceMatrixByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE2, [10], [23],
         True,
         data_type='distance_matrix')
Exemple #4
0
 def runRemoveLibraryCoreTest(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5], True)
 def testClusterAllocationSampleSimple1ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5], True)
 def testItermax10Simple01(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5], True, itermax=10)
 def testProcessingWhenLibraryCoreCorrupted(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5], True)
 def testClusterTheSameData1ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE9, [2, 20], [10, 20], True)
Exemple #9
0
 def testClusterAllocationSampleSimple5DistanceMatrix(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE5, [4, 18, 34, 55], [15, 15, 15, 15], False, data_type='distance_matrix')
Exemple #10
0
 def testClusterAllocationSampleSimple3WithMedoidsInitializer(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE3, None, [10, 10, 10, 30], False, initialize_medoids=4)
Exemple #11
0
 def testClusterOneAllocationSampleSimple3(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE3, [30], [60], False)
Exemple #12
0
 def testClusterAllocationSampleSimple3DistanceMatrix(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE3, [4, 12, 25, 37], [10, 10, 10, 30], False, data_type='distance_matrix')
Exemple #13
0
 def testClusterAllocationSampleSimple2DistanceMatrix(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE2, [3, 12, 20], [10, 5, 8], False, data_type='distance_matrix')
Exemple #14
0
 def testClusterOneAllocationSampleSimple1DistanceMatrix(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [5], [10], False, data_type='distance_matrix')
Exemple #15
0
 def testClusterAllocationSampleSimple1WrongInitials1ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [1, 2, 3, 4], [2, 2, 3, 3], True)
 def testClusterAllocationSampleSimple5ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE5, [4, 18, 34, 55], [15, 15, 15, 15],
         True)
 def testClusterOneAllocationSampleSimple5ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE5, [35], [60], True)
Exemple #18
0
 def testClusterTheSameData1DistanceMatrix(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE9, [2, 20], [10, 20], False, data_type='distance_matrix')
 def testClusterTheSameData2ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE12, [2, 7, 12], [5, 5, 5], True)
Exemple #20
0
 def testClusterTheSameData2DistanceMatrix(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE12, [2, 7, 12], [5, 5, 5], False, data_type='distance_matrix')
 def testItermax0(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [], True, itermax=0)
Exemple #22
0
 def testItermax1(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5], False, itermax=1)
 def testItermax10Simple02(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE2, [3, 12, 20], [10, 5, 8],
         True,
         itermax=10)
Exemple #24
0
 def testClusterAllocationSampleSimple1DistanceMatrixNumpy(self):
     kmedoids_test_template.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5], False, data_type='distance_matrix', input_type='numpy')
 def testClusterAllocationSampleSimple1DistanceMatrixByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [2, 9], [5, 5],
         True,
         data_type='distance_matrix')
 def testClusterAllocationSampleSimple2ByCore(self):
     kmedoids_test_template.templateLengthProcessData(
         SIMPLE_SAMPLES.SAMPLE_SIMPLE2, [3, 12, 20], [10, 5, 8], True)