Browse Source

Update 3rd stage

master
AlirezaT99 1 year ago
parent
commit
cb2d4e6f16
2 changed files with 36 additions and 1 deletions
  1. 5
    1
      3-TrainMogonet/README.md
  2. 31
    0
      3-TrainMogonet/runner.py

+ 5
- 1
3-TrainMogonet/README.md View File



3. Run `main_mogonet.py` to train the network and store the model 3. Run `main_mogonet.py` to train the network and store the model


4. Run `main_biomarker.py` to evaluate the feature importances and extract biomarkers from the model.
4. Run `main_biomarker.py` to evaluate the feature importances and extract biomarkers from the model.

### Alternative approach

Or you can configurate the `runner.py` code and run it.

+ 31
- 0
3-TrainMogonet/runner.py View File

import os
import copy

from mogonet.feat_importance import cal_feat_imp, summarize_imp_feat
from mogonet.train_test import train_test

data_folder = 'ICGC'
view_list = [1, 2]


def run_mogonet(num_class):
os.chdir('./mogonet')
num_epoch_pretrain = 500
num_epoch = 2500
lr_e_pretrain = 1e-3
lr_e = 5e-4
lr_c = 1e-3
train_test(data_folder, view_list, num_class,
lr_e_pretrain, lr_e, lr_c,
num_epoch_pretrain, num_epoch)


def run_biomarker(num_class):
os.chdir('./mogonet')
model_folder = os.path.join(data_folder, 'models')
featimp_list_list = []
for rep in range(5):
featimp_list = cal_feat_imp(data_folder, os.path.join(model_folder, str(rep + 1)),
view_list, num_class)
featimp_list_list.append(copy.deepcopy(featimp_list))
summarize_imp_feat(featimp_list_list)

Loading…
Cancel
Save