diff options
Diffstat (limited to 'Metrics/Metrics-Calculation/metrics_plot/src/test.py')
-rw-r--r-- | Metrics/Metrics-Calculation/metrics_plot/src/test.py | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/Metrics/Metrics-Calculation/metrics_plot/src/test.py b/Metrics/Metrics-Calculation/metrics_plot/src/test.py deleted file mode 100644 index 0212cc2a..00000000 --- a/Metrics/Metrics-Calculation/metrics_plot/src/test.py +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | from pyclustering.cluster.kmedoids import kmedoids | ||
2 | from pyclustering.utils import read_sample | ||
3 | from pyclustering.samples.definitions import FCPS_SAMPLES | ||
4 | from pyclustering.utils.metric import distance_metric, type_metric | ||
5 | import matplotlib.pyplot as plt | ||
6 | |||
7 | # metric = distance_metric(type_metric.MINKOWSKI, degree=2) | ||
8 | # print(metric([1,1], [2,2])) | ||
9 | |||
10 | # Load list of points for cluster analysis. | ||
11 | sample = [[1,1,1], [2,2,2],[3,3,3]] | ||
12 | |||
13 | # Set random initial medoids. | ||
14 | initial_medoids = [1, 1 ,1] | ||
15 | # Create instance of K-Medoids algorithm. | ||
16 | kmedoids_instance = kmedoids(sample, initial_medoids) | ||
17 | # Run cluster analysis and obtain results. | ||
18 | kmedoids_instance.process() | ||
19 | centoids = kmedoids_instance.get_medoids() | ||
20 | clusters = kmedoids_instance.get_clusters() | ||
21 | # Show allocated clusters. | ||
22 | for cluster_id in range(len(clusters)): | ||
23 | for index in clusters[cluster_id]: | ||
24 | if(cluster_id == 0): | ||
25 | plt.plot(sample[index][0], sample[index][1], 'ro') | ||
26 | print(sample[index][0]) | ||
27 | else: | ||
28 | plt.plot(sample[index][0], sample[index][1], 'bo') | ||
29 | |||
30 | plt.plot(sample[centoids[0]][0], sample[centoids[0]][1], 'bo') | ||
31 | # plt.plot(sample[centoids[1]][0], sample[centoids[1]][1], 'ro') | ||
32 | plt.show() \ No newline at end of file | ||