本文整理汇总了Python中pyclustering.cluster.tests.kmeans_templates.KmeansTestTemplates类的典型用法代码示例。如果您正苦于以下问题:Python KmeansTestTemplates类的具体用法?Python KmeansTestTemplates怎么用?Python KmeansTestTemplates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KmeansTestTemplates类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: templateKmeansPlusPlusForClustering
def templateKmeansPlusPlusForClustering(self, path_sample, amount, expected_clusters_length):
result_success = True
for _ in range(3):
try:
sample = read_sample(path_sample)
start_centers = kmeans_plusplus_initializer(sample, amount).initialize()
KmeansTestTemplates.templateLengthProcessData(path_sample, start_centers, expected_clusters_length, False)
except AssertionError:
continue
break
assert result_success == True;
示例2: testWrongNumberOfCentersSimpleSample5
def testWrongNumberOfCentersSimpleSample5(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE5, [[-1.9, 3.2], [1.2, 34.5], [15.2, 34.8], [192, 234], [-32.3, -106]], None, False)
示例3: testClusterOneAllocationSampleSimple2
def testClusterOneAllocationSampleSimple2(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE2, [[0.5, 0.2]], [23], False)
示例4: testClusterAllocationSampleSimple1ChiSquare
def testClusterAllocationSampleSimple1ChiSquare(self):
metric = distance_metric(type_metric.CHI_SQUARE)
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [[3.7, 5.5], [6.7, 7.5]], [5, 5], False, metric=metric)
示例5: testClusterAllocationSampleSimple1UserDefinedInfitityProcessing
def testClusterAllocationSampleSimple1UserDefinedInfitityProcessing(self):
metric = distance_metric(type_metric.USER_DEFINED, func=lambda p1, p2: p1[0] + p2[0] + 2)
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [[3.7, 5.5], [6.7, 7.5]], [10], False, metric=metric)
示例6: testClusterAllocationSampleSimple1UserDefined1
def testClusterAllocationSampleSimple1UserDefined1(self):
metric = distance_metric(type_metric.USER_DEFINED, func=distance_metric(type_metric.EUCLIDEAN))
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [[3.7, 5.5], [6.7, 7.5]], [5, 5], False, metric=metric)
示例7: testClusterAllocationSampleSimple1Manhattan
def testClusterAllocationSampleSimple1Manhattan(self):
metric = distance_metric(type_metric.MANHATTAN)
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [[3.7, 5.5], [6.7, 7.5]], [5, 5], False, metric=metric)
示例8: testClusterAllocationSampleSimple1
def testClusterAllocationSampleSimple1(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [[3.7, 5.5], [6.7, 7.5]], [5, 5], False)
示例9: testObserveSampleSimple1
def testObserveSampleSimple1(self):
KmeansTestTemplates.templateCollectEvolution(SIMPLE_SAMPLES.SAMPLE_SIMPLE1, [[3.5, 5.6], [6.8, 7.4]], [5, 5], False)
示例10: testClusterAllocationOneDimensionData
def testClusterAllocationOneDimensionData(self):
KmeansTestTemplates.templateClusterAllocationOneDimensionData(False)
示例11: testThreeDimensionalData1
def testThreeDimensionalData1(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE11, [[1.0, 0.6, 0.8], [4.1, 4.2, 4.3]], [10, 10], False)
示例12: testOneDimensionalData2
def testOneDimensionalData2(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE9, [[4.5], [6.2]], [20, 10], False)
示例13: testOneDimensionalData1
def testOneDimensionalData1(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE8, [[-2.0], [3.0], [6.0], [12.0]], [15, 30, 20, 80], False)
示例14: testTheSameData2
def testTheSameData2(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE12, [ [1.0, 1.0], [2.5, 2.5], [4.0, 4.0] ], [5, 5, 5], False)
示例15: testTheSameData1
def testTheSameData1(self):
KmeansTestTemplates.templateLengthProcessData(SIMPLE_SAMPLES.SAMPLE_SIMPLE9, [ [4.0], [8.0] ], [10, 20], False)