-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTesting.py
More file actions
55 lines (36 loc) · 1.99 KB
/
Copy pathTesting.py
File metadata and controls
55 lines (36 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import numpy as np
import random_data
import kmeans
import seeds
import matplotlib.pyplot as plt
import pandas as pd
#seed_data = np.loadtxt("Data/seeds_dataset.txt", delimiter="\t", usecols=(0,1,2,3,4,5,6,7))
#plus_seed_test = kmeans.kmeans_func(seed_data, seed_method="plusplus", K=3, nstarts=10, table_output=True, true_labels_included=True)
# All iris attributes are interesting. K=3
#iris_data = np.loadtxt("Data/iris.txt", delimiter=",", usecols=(0,1,2,3,4))
#plus_iris_test = kmeans.kmeans_func(iris_data, seed_method="plusplus", K=3, nstarts=10, table_output=True, true_labels_included=True)
#print(plus_iris_test)
#test_data = np.loadtxt("Data/testmakeclusters.txt", delimiter=",")
#plus_test_test = kmeans.kmeans_func(test_data, seed_method="plusplus", K=4, nstarts=10, table_output=True, true_labels_included=True)
#print(plus_test_test)
### MAKE CLUSTERS
#random_data.make_clusters(N=1000, d=3, K=9, save_data=True, length = 1000)
### PERFORM COMPARATIVE TESTS
#print("Performing test: K=9, s=1, k-means++")
#test1_data = np.loadtxt("Data/Comparative_study/datak9.txt", delimiter=",")
#test1 = kmeans.kmeans_func(test1_data, seed_method="plusplus", K=9, nstarts=1, table_output=True, true_labels_included=True)
#print(test1)
#print("-----------------------------")
#seeds_data = np.loadtxt("Data/seeds_dataset.txt", delimiter="\t", usecols=(0,1,2,3,4,5,6,7))
#plt.scatter(seeds_data[:,0], seeds_data[:,6], c=pd.factorize(seeds_data[:,7])[0])
#plt.show()
### TABLE 3
#random_data.make_clusters(N=1000, d=3, K=9, save_data=True, length = 1000)
#print("9")
print("Performing test: K=5, s=77, UnifRandom")
test1_data = np.loadtxt("Data/Unif_vs_batched_data/uni_vs_batched_k5.txt", delimiter=",")
#test1_data = np.loadtxt("Data/UCI_data/seeds_dataset.txt", delimiter="\t")
#test1_data = np.loadtxt("Data/UCI_data/iris.txt", delimiter=",")
test1 = kmeans.kmeans_func(test1_data, seed_method="random", K=5, nstarts=77, table_output=True, true_labels_included=True)
print(test1)
print("-----------------------------")