/
main.py
58 lines (54 loc) · 1.72 KB
/
main.py
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
56
57
__author__ = 'ansaev'
from model import Point,Points
from kmeans import Kmeans
from pca import Pca
# print('iris fishers')
# points = Points()
# points.init(file_name="iris.xls", start_row=0, dim=4)
# kmeans = Kmeans(points=points.points, centroid_num=3)
# kmeans.distribute()
# error = kmeans.check()
# print('iris fishers')
# print("error is %f%%" % (error*100))
#
# print('separated sets')
# points = Points()
# points.init(file_name="separated_sets.xls", start_row=0, dim=5)
# kmeans = Kmeans(points=points.points, centroid_num=5)
# kmeans.distribute()
# error = kmeans.check()
# print('separated sets')
# print("error is %f%%" % (error*100))
#
# print('separated sets normalize')
# points = Points()
# points.init(file_name="separated_sets_norma.xls", start_row=0, dim=5)
# kmeans = Kmeans(points=points.points, centroid_num=5)
# kmeans.distribute()
# error = kmeans.check()
# print('separated sets normalize')
# print("error is %f%%" % (error*100))
#
# print('none separated sets')
# points = Points()
# points.init(file_name="sets_connected.xls", start_row=0, dim=5)
# kmeans = Kmeans(points=points.points, centroid_num=5)
# kmeans.distribute()
# error = kmeans.check()
# print('none separated sets')
# print("error is %f%%" % (error*100))
#
# print('none separated sets normalize')
# points = Points()
# points.init(file_name="sets_connected_norma.xls", start_row=0, dim=5)
# kmeans = Kmeans(points=points.points, centroid_num=5)
# kmeans.distribute()
# error = kmeans.check()
# print('none separated sets normalize')
# print("error is %f%%" % (error*100))
points = Points()
points.init(file_name="iris.xls", start_row=0, end_row=2, dim=4)
prc = Pca(points=points.points)
prc.distribute()
error = prc.check()
print("error is %f%%" % (error*100))