-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
27 lines (20 loc) · 803 Bytes
/
run.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
import matplotlib.pyplot as plt
import FCMeans
"""
.. sectionauthor:: Ali ArjomandBigdeli <https://github.com/aliarjomandbigdeli>
.. since:: 5/1/2019
"""
def main():
cluster_num = input("Enter number of cluster: ")
data_num = input("Enter number of data(data set size): ")
my_fcm = FCMeans.FCM()
my_fcm.create_random_data(int(data_num), 2, int(cluster_num))
my_fcm.exec(int(cluster_num), 100, my_fcm.data())
plt.plot(my_fcm.data()[:, 0], my_fcm.data()[:, 1], 'bo')
for ct in my_fcm.cluster_centers():
plt.plot(ct[0], ct[1], 'r*')
plt.grid(b=None, which='both', axis='both', color='gray', linestyle='-', linewidth=2)
plt.title('number of clusters: ' + cluster_num + ', number of data: ' + data_num)
plt.show()
if __name__ == '__main__':
main()