-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
52 lines (40 loc) · 1.34 KB
/
run.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
import pandas as pd
import nibabel as nb
import numpy as np
import matplotlib.pyplot as plt
import os
import glob
from sklearn.ensemble import RandomForestClassifier
from sktree import ObliqueRandomForestClassifier, PatchObliqueRandomForestClassifier
from tqdm import tqdm
from sklearn.model_selection import train_test_split
import random
import pickle
import scipy.stats as ss
total_models = 1000
feature_imp = []
with open('feature_imp_gray_NHP.pickle','rb') as f:
feature_imp = pickle.load(f)
#print(len(feature_imp), 'its the length')
for ii in tqdm(range(500,total_models)):
with open('morf_models/NHP_model'+str(ii)+'_gray.pickle','rb') as f:
morf = pickle.load(f)
feature_imp.append(
morf.feature_importances_
)
del morf
with open('feature_imp_gray_NHP.pickle','wb') as f:
pickle.dump(feature_imp, f)
#############################################################
feature_imp = []
with open('feature_imp_white_NHP.pickle','rb') as f:
feature_imp = pickle.load(f)
for ii in tqdm(range(500,total_models)):
with open('morf_models/NHP_model'+str(ii)+'_white.pickle','rb') as f:
morf = pickle.load(f)
feature_imp.append(
morf.feature_importances_
)
del morf
with open('feature_imp_white_NHP.pickle','wb') as f:
pickle.dump(feature_imp, f)