-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_student_layers_plot.py
More file actions
66 lines (52 loc) · 3.29 KB
/
delete_student_layers_plot.py
File metadata and controls
66 lines (52 loc) · 3.29 KB
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
import matplotlib.pyplot as plt
from readData import *
#caltech101,student 0.0001
# teacher
teacher = save_data_to_list(read_data("teacher"))
print("teacher: " + str(caculate_convergence_time(teacher)))
plt.plot(teacher, label="teacher")
# independent_student, not initialization, 5 conv + 2 fc
independent_student_not_initialization = save_data_to_list(read_data("method1_interval/independent_student_not_initialization"))
print("independent_student: " + str(caculate_convergence_time(independent_student_not_initialization)))
#plt.plot(independent_student_not_initialization, label="independent_student(5 conv + 2 fc)")
path = "delete_student_layers/independentStudent/"
# independent_student, not initialization, 4 conv + 1 fc
conv4_fc1 = save_data_to_list(read_data(path+"conv4_fc1"))
print("independent_student(4 conv + 1 fc): " + str(caculate_convergence_time(conv4_fc1)))
#plt.plot(conv4_fc1, label="independent_student(4 conv + 1 fc)")
# independent_student, not initialization, 3 conv + 1 fc
conv3_fc1 = save_data_to_list(read_data(path+"conv3_fc1"))
print("independent_student(3 conv + 1 fc): " + str(caculate_convergence_time(conv3_fc1)))
#plt.plot(conv3_fc1, label="independent_student(3 conv + 1 fc)")
# independent_student, not initialization, 2 conv + 1 fc
conv2_fc1 = save_data_to_list(read_data(path+"conv2_fc1"))
print("independent_student(2 conv + 1 fc): " + str(caculate_convergence_time(conv2_fc1)))
#plt.plot(conv2_fc1, label="independent_student(2 conv + 1 fc)")
# independent_student, not initialization, 1 conv + 1 fc
conv1_fc1 = save_data_to_list(read_data(path+"conv1_fc1"))
print("independent_student(1 conv + 1 fc): " + str(caculate_convergence_time(conv1_fc1)))
#plt.plot(conv1_fc1, label="independent_student(1 conv + 1 fc)")
# independent_student, not initialization, 1 fc
fc1 = save_data_to_list(read_data(path+"1fc"))
print("independent_student(1 fc: " + str(caculate_convergence_time(fc1)))
#plt.plot(fc1, label="independent_student(1 fc)")
# dependent_student, connect every time, add initialization, 5 conv + 2 fc
interval_1_add_initialization = save_data_to_list(read_data("method1_interval/interval_1_add_initialization"))
print("dependent_student(5 conv + 2 fc): " + str(caculate_convergence_time(interval_1_add_initialization)))
#plt.plot(interval_1_add_initialization, label="dependent_student(5 conv + 2 fc)")
path = "delete_student_layers/DependentStudent/"
# dependent_student, add initialization, 3 conv + 1 fc
dependent_student_conv3_fc1 = save_data_to_list(read_data(path+"conv3_fc1"))
print("dependent_student(3 conv + 1 fc): " + str(caculate_convergence_time(dependent_student_conv3_fc1)))
plt.plot(dependent_student_conv3_fc1, label="dependent_student(3 conv + 1 fc)")
# dependent_student, add initialization, 4 conv + 1 fc
dependent_student_conv4_fc1 = save_data_to_list(read_data(path+"conv4_fc1"))
print("dependent_student(4 conv + 1 fc): " + str(caculate_convergence_time(dependent_student_conv4_fc1)))
#plt.plot(dependent_student_conv4_fc1, label="dependent_student(4 conv + 1 fc)")
#plt.title("Caltech101: Dependent Student---conv5_fc2 (lerning rate: 0.001)")
#plt.title("Caltech101: Dependent Student---conv4_fc1 (lerning rate: 0.001)")
plt.title("Caltech101: Dependent Student---conv3_fc1 (lerning rate: 0.001)")
plt.xlabel("epoch")
plt.ylabel("accuracy")
plt.legend().draggable()
plt.show()