-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
33 lines (29 loc) · 896 Bytes
/
Copy pathplot.py
File metadata and controls
33 lines (29 loc) · 896 Bytes
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
import matplotlib.pyplot as plt
def get_data(file_name):
content = []
with open(file_name) as f:
content = f.readlines() # read file line by line
content = [x.strip() for x in content]
return content
def get_info(content):
sizes = []
algo = []
ward = []
for e in range(len(content)):
c = content[e].split()
if e % 3 == 0:
sizes.append(int(c[4]))
if e % 3 == 1:
algo.append(float(c[1]))
if e % 3 == 2:
ward.append(float(c[1]))
return sizes, algo, ward
content = get_data('result100_25_128.txt')
sizes, algo, ward = get_info(content)
plt.plot(sizes, algo, label = 'Ward-approx')
plt.plot(sizes, ward, label = 'Ward')
plt.title('Accuracy of Ward-approx (e = 10, T = 25, L = 128) vs Ward')
plt.legend(loc = 'best')
plt.xlabel('Number of Points')
plt.ylabel('Accuracy NMI')
plt.show()