-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_learning_curve.py
89 lines (70 loc) · 2.48 KB
/
plot_learning_curve.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import matplotlib.pyplot as plt
import numpy as np
train_set = [
int(i) for i in ['1000', '2000', '4000', '8000', '10000', '20000', '30000']
]
y1 = [] # Only molecular descriptors
y2 = [] # Mol Desc + DFTB
y3 = [] # Kernel
y4 = [] # Desc + DFTB (with standard)
y5 = []
for i in train_set:
try:
f1 = open("only_CM/%s/errors_test.dat" % i, 'r')
f2 = open("standard/%s/errors_test.dat" % i, 'r')
f3 = open("only_CM/new/%s/errors_test.dat" % i, 'r')
f4 = open("withdft/new/%s/errors_test.dat" % i, 'r')
f5 = open("only_CM/new/%s/errors_test.dat"%i,'r')
except Exception as e:
print("*******\n")
print(e)
print(i)
try:
lines1 = f1.readlines()
a, b, c = lines1[0].split()
y1.append(round(float(b), 3)) # Rounded upto 3 decimal places
except:
pass
try:
lines2 = f2.readlines()
a, b, c = lines2[0].split()
y2.append(round(float(b), 3)) # Rounded upto 3 decimal places
except:
pass
try:
lines3 = f3.readlines()
a, b, c = lines3[0].split()
y3.append(round(float(b), 3)) # Rounded upto 3 decimal places
except:
pass
try:
lines4 = f4.readlines()
a, b, c = lines4[0].split()
y4.append(round(float(b), 3)) # Rounded upto 3 decimal places
except:
pass
# lines5 = f5.readlines()
# a, b, c = lines5[0].split()
# y5.append(round(float(b), 3)) # Rounded upto 3 decimal places
print(y1)
print(y2)
print(y3)
print(y4)
# print(y5)
# plt.yscale("log")
plt.grid(True, which="both")
plt.loglog(train_set, y1, 's-', label='Architecture 1')
plt.loglog(train_set, y2, 's-', label='Architecture 2')
plt.loglog(train_set, y3, 'o:', label='Architecture 2 With Data Standardization')
plt.loglog(train_set[:5], y4, 's-', label='Arch 2')
# plt.loglog(train_set, y5, 'o-', label='new arch- only CM')
# plt.annotate('(%s, %s)' % (30000, y1[-1]), xy=(30000, y1[-1]), textcoords='data')
# plt.annotate('(%s, %s)' % (20000, y1[-2]), xy=(20000, y1[-2]), textcoords='data')
# plt.annotate('(%s, %s)' % (30000, y2[-1]), xy=(30000, y2[-1]), textcoords='data')
# plt.annotate('(%s, %s)' % (20000, y2[-2]), xy=(20000, y2[-2]), textcoords='data')
# plt.annotate('(%s, %s)' % (30000, y4[-1]), xy=(30000, y4[-1]), textcoords='data')
plt.xlabel('Training size')
plt.ylabel('MAE [EAT] (eV)')
plt.title('Learning Curve of simple Sequential network (Strongly distorted Molecules)')
plt.legend()
plt.show()