-
Notifications
You must be signed in to change notification settings - Fork 0
/
validation.py
45 lines (41 loc) · 1.55 KB
/
validation.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
from brain_matrix import BrainMatrix
from utils import Timer
import pandas as pd
#import seaborn as sns
if __name__ == '__main__':
features = ['language',
'music',
'navigation',
'spatial',
'reading',
'action',
'hippocampus',
'auditory',
'broca',
'gestures',
'hearing',
'learning',
'motor',
'movement',
'speech',
'syntactic',
'verbal',
'visuospatial']
folds = [features[a:b] for a, b in [(0,6), (6,12), (12,18)]]
data = []
with open('times.txt', 'w+') as log:
for fold_id, fold in enumerate(folds):
for ds in range(6,11):
with Timer('DOWNSAMPLED BY {ds}\n'.format_map(locals()),
print_func=log.write) as t:
matrix = BrainMatrix('emd', downsample=ds, name='validation')
matrix.compute_distances(fold)
inconsistency = matrix.plot_dendrogram()
stress = matrix.plot_mds(metric=False)
data.append([ds, fold_id, t.elapsed, inconsistency, stress])
df = pd.DataFrame(columns=['downsample', 'fold', 'time', 'inconsistency', 'stress'], data=data)
df.to_pickle('validation.pkl')
#f, ax = sns.plt.subplots(figsize=(7, 7))
#ax.set(yscale="log")
#sns.pointplot(x='features', y='time', hue='downsample', data=df)
#sns.plt.show()