|
a |
|
b/test/test_dummy_boosting_stacking.py |
|
|
1 |
""" |
|
|
2 |
test one instance of SimDeep |
|
|
3 |
""" |
|
|
4 |
|
|
|
5 |
from os.path import abspath |
|
|
6 |
from os.path import split |
|
|
7 |
|
|
|
8 |
from os.path import isfile |
|
|
9 |
from os.path import isdir |
|
|
10 |
|
|
|
11 |
from os import remove |
|
|
12 |
from shutil import rmtree |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
def test_instance(): |
|
|
17 |
""" |
|
|
18 |
test stacked of SimDeepBoosting |
|
|
19 |
""" |
|
|
20 |
from simdeep.simdeep_boosting import SimDeepBoosting |
|
|
21 |
|
|
|
22 |
PATH_DATA = '{0}/../examples/data/'.format(split(abspath(__file__))[0]) |
|
|
23 |
|
|
|
24 |
TRAINING_TSV = {'RNA': 'rna_dummy.tsv', 'METH': 'meth_dummy.tsv'} |
|
|
25 |
SURVIVAL_TSV = 'survival_dummy.tsv' |
|
|
26 |
|
|
|
27 |
PROJECT_NAME = 'stacked_TestProject' |
|
|
28 |
EPOCHS = 10 |
|
|
29 |
SEED = 3 |
|
|
30 |
nb_it = 5 |
|
|
31 |
nb_threads = 2 |
|
|
32 |
|
|
|
33 |
boosting = SimDeepBoosting( |
|
|
34 |
# stack_multi_omic=True, |
|
|
35 |
nb_threads=nb_threads, |
|
|
36 |
nb_it=nb_it, |
|
|
37 |
split_n_fold=3, |
|
|
38 |
survival_tsv=SURVIVAL_TSV, |
|
|
39 |
training_tsv=TRAINING_TSV, |
|
|
40 |
path_data=PATH_DATA, |
|
|
41 |
project_name=PROJECT_NAME, |
|
|
42 |
path_results=PATH_DATA, |
|
|
43 |
epochs=EPOCHS, |
|
|
44 |
# normalization={'TRAIN_CORR_REDUCTION':True}, |
|
|
45 |
seed=SEED) |
|
|
46 |
|
|
|
47 |
boosting.fit() |
|
|
48 |
boosting.predict_labels_on_full_dataset() |
|
|
49 |
boosting.compute_clusters_consistency_for_full_labels() |
|
|
50 |
boosting.evalutate_cluster_performance() |
|
|
51 |
boosting.collect_cindex_for_test_fold() |
|
|
52 |
boosting.collect_cindex_for_full_dataset() |
|
|
53 |
|
|
|
54 |
boosting.compute_feature_scores_per_cluster() |
|
|
55 |
boosting.write_feature_score_per_cluster() |
|
|
56 |
|
|
|
57 |
boosting.load_new_test_dataset( |
|
|
58 |
{'METH': 'meth_dummy.tsv'}, |
|
|
59 |
'survival_dummy.tsv', |
|
|
60 |
'dummy', |
|
|
61 |
# normalization={'TRAIN_NORM_SCALE':True}, |
|
|
62 |
) |
|
|
63 |
|
|
|
64 |
boosting.predict_labels_on_test_dataset() |
|
|
65 |
boosting.compute_c_indexes_for_test_dataset() |
|
|
66 |
boosting.compute_clusters_consistency_for_test_labels() |
|
|
67 |
|
|
|
68 |
from glob import glob |
|
|
69 |
|
|
|
70 |
for fil in glob('{0}/{1}*'.format(PATH_DATA, PROJECT_NAME)): |
|
|
71 |
if isfile(fil): |
|
|
72 |
remove(fil) |
|
|
73 |
elif isdir(fil): |
|
|
74 |
rmtree(fil) |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
if __name__ == '__main__': |
|
|
78 |
test_instance() |