-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
65 lines (52 loc) · 3.09 KB
/
plot.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
import numpy as np
import matplotlib.pyplot as plt
digit = "10"
algo1 = "RXCSi"
algo1_label = "XCS-IMG"
max_pop1 = 35000
algo2 = "XCSRCFC"
max_pop2 = 35000
# test_performance1 = np.loadtxt("../remote/output/" + algo1 +"/output-" + digit + "-digit/" + digit + "-digits-" + run1 + "/test_performance.txt")
# test_performance2 = np.loadtxt("../remote/output/"+algo2+"/output-"+digit+"-digit/"+digit+"-digits-"+run2+"/test_performance.txt")
# title = algo1 + "_" + digit + "_" + run1 + " vs " + algo2 + "_" + digit + "_" + run2
test_performance1 = np.loadtxt("../remote/output/" + algo1 +"/output-" + digit + "-digit/" + "summary/" + algo1 + "-" + digit + "-01-30-validation_performance_avg.txt")
test_performance1_sd = np.loadtxt("../remote/output/" + algo1 +"/output-" + digit + "-digit/" + "summary/" + algo1 + "-" + digit + "-01-30-validation_performance_sd.txt")
test_performance2 = np.loadtxt("../remote/output/" + algo2 + "/output-" +digit + "-digit/" + "summary/" + algo2 + "-" + digit + "-01-30-validation_performance_avg.txt")
test_performance2_sd = np.loadtxt("../remote/output/" + algo2 + "/output-" +digit + "-digit/" + "summary/" + algo2 + "-" + digit + "-01-30-validation_performance_sd.txt")
title = 'Average Training Accuracy for ' + digit + ' digits'
plt.errorbar(test_performance1[:, 0], test_performance1[:, 1], yerr=test_performance1_sd[:, 1], label=algo1_label, color='k', linestyle='solid')
plt.errorbar(test_performance2[:, 0], test_performance2[:, 1], yerr=test_performance2_sd[:, 1], label=algo2, color='0.5', linestyle='solid')
plt.title(title)
plt.legend(loc='lower right')
plt.ylim(0.8, 1)
plt.ylabel('Performance')
plt.xlabel('Instances')
plt.savefig('plots/' + title + '.png')
plt.show()
title = 'Average Validation Accuracy for ' + digit + ' digits'
plt.errorbar(test_performance1[:, 0], test_performance1[:, 4], yerr=test_performance1_sd[:, 4], label=algo1_label, color='k', linestyle='solid')
plt.errorbar(test_performance2[:, 0], test_performance2[:, 4], yerr=test_performance2_sd[:, 4], label=algo2, color='0.5', linestyle='solid')
plt.title(title)
plt.legend(loc='lower right')
plt.ylim(0.8, 1)
plt.ylabel('Performance')
plt.xlabel('Instances')
plt.savefig('plots/' + title + '.png')
plt.show()
# plt.plot(test_performance1[:, 0], test_performance1[:, 2], label=algo1 + ' ' + run1 + ' Training')
# plt.plot(test_performance2[:, 0], test_performance2[:, 2], label=algo2 + ' ' + run2 + ' Training')
# plt.plot(test_performance1[:, 0], test_performance1[:, 5], label=algo1 + ' ' + run1 + ' Validation')
# plt.plot(test_performance2[:, 0], test_performance2[:, 5], label=algo2 + ' ' + run2 + ' Validation')
# plt.title('Error ' + title)
# plt.legend(loc='upper right')
# plt.savefig('plots/' + title + ' Error' + '.png')
# plt.show()
#
#
# plt.plot(test_performance2[:, 0], test_performance1[:, 6]/max_pop1, label=algo1 + ' ' + run1 + ' Population')
# plt.plot(test_performance2[:, 0], test_performance2[:, 6]/max_pop2, label=algo2 + ' ' + run2 + ' Population')
# plt.title('Population Size ' + title)
# plt.legend(loc='lower left')
# plt.savefig('plots/' + title + ' Population Size' + '.png')
# plt.show()
print('done')