Skip to content

Commit 6a099bb

Browse files
committed
adding time report for each model
1 parent 908e3e1 commit 6a099bb

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

HCP_fmripredict/my_test_mnist_gcn.py

+25-5
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ def grid_graph(m, corners=False):
9797

9898
####training and testing models
9999
print(L)
100+
101+
t_start = time.process_time()
100102
model_perf.test(models.cgcnn(config_TF, L, **params), name, params,
101103
train_data_perm, train_labels, val_data_perm, val_labels, test_data_perm, test_labels)
102-
104+
t_end_1 = time.process_time() - t_start
105+
print('Model {}; Execution time: {:.2f}s\n\n'.format(name, t_end_1))
103106

104107
###model#2: one-layer convolution with fourier transform as filter
105108
common['regularization'] = 0
@@ -117,8 +120,12 @@ def grid_graph(m, corners=False):
117120
params['dir_name'] += name
118121
params['filter'] = 'fourier'
119122
params['K'] = [L[0].shape[0]]
120-
model_perf.test(models.cgcnn(config_TF,L, **params), name, params,
123+
124+
t_start = time.process_time()
125+
model_perf.test(models.cgcnn(config_TF, L, **params), name, params,
121126
train_data_perm, train_labels, val_data_perm, val_labels, test_data_perm, test_labels)
127+
t_end_2 = time.process_time() - t_start
128+
print('Model {}; Execution time: {:.2f}s\n\n'.format(name, t_end_2))
122129

123130
##model#3: one-layer convolution with chebyshev5 and b1relu as filters
124131
name = 'cgconv_softmax'
@@ -127,8 +134,12 @@ def grid_graph(m, corners=False):
127134
params['filter'] = 'chebyshev5'
128135
# params['filter'] = 'chebyshev2'
129136
# params['brelu'] = 'b2relu'
137+
138+
t_start = time.process_time()
130139
model_perf.test(models.cgcnn(config_TF,L, **params), name, params,
131140
train_data_perm, train_labels, val_data_perm, val_labels, test_data_perm, test_labels)
141+
t_end_3 = time.process_time() - t_start
142+
print('Model {}; Execution time: {:.2f}s\n\n'.format(name, t_end_3))
132143

133144
##model#4: two convolutional layers with fourier transform as filters
134145
common['regularization'] = 5e-4
@@ -151,7 +162,9 @@ def grid_graph(m, corners=False):
151162
t_start = time.process_time()
152163
model_perf.test(models.cgcnn(config_TF,L, **params), name, params,
153164
train_data_perm, train_labels, val_data_perm, val_labels, test_data_perm, test_labels)
154-
print('Execution time: {:.2f}s'.format(time.process_time() - t_start))
165+
t_end_4 = time.process_time() - t_start
166+
print('Model {}; Execution time: {:.2f}s\n\n'.format(name, t_end_4))
167+
155168

156169

157170
##model#5: two convolutional layers with Chebyshev polynomial as filters
@@ -165,8 +178,15 @@ def grid_graph(m, corners=False):
165178
t_start = time.process_time()
166179
model_perf.test(models.cgcnn(config_TF,L, **params), name, params,
167180
train_data_perm, train_labels, val_data_perm, val_labels, test_data_perm, test_labels)
168-
print('Execution time: {:.2f}s'.format(time.process_time() - t_start))
181+
t_end_5 = time.process_time() - t_start
182+
print('Model {}; Execution time: {:.2f}s\n\n'.format(name, t_end_5))
183+
169184

170185

171186
###summary
172-
model_perf.show()
187+
model_perf.show()
188+
print('Execution time for model1: {:.2f}s\n\n'.format(t_end_1))
189+
print('Execution time for model2: {:.2f}s\n\n'.format(t_end_2))
190+
print('Execution time for model3: {:.2f}s\n\n'.format(t_end_3))
191+
print('Execution time for model4: {:.2f}s\n\n'.format(t_end_4))
192+
print('Execution time for model5: {:.2f}s\n\n'.format(t_end_5))

0 commit comments

Comments
 (0)