Main Script of the study

Created on Thu Dec 3 10:07:36 2020

This script is for detection IDH and TERTp mutation in gliomas. 1D-CNN is the approach that we use in this study. This study was submitted to ISMRM 2021

Abdullah BAS abdullah.bas@boun.edu.tr BME Bogazici University Istanbul / Uskudar @author: abas

main.get_data_loaders(train_batch_size, test_batch_size)

This function is for initializing data_loaders

Parameters
  • train_batch_size (int) – Can be manipulated from config.py

  • test_batch_size (int) – Can be manipulated from config.py

Returns

Returns train and test dataloaders.

Return type

dataloaders

main.test(model, test_loader)

Testing loop for optuna

Parameters
  • model (torch.model) – model to input

  • test_loader (dataloader) – dataloader for testing

Returns

accuracy acc1 [float]: accuracy of class1 acc2 [float]: accuracy of class2 losses [list]: loss list

Return type

accuracy [float]

main.train(log_interval, model, train_loader, optimizer, epoch)

This is for training loop of optuna

Parameters
  • log_interval (int) – Logging interval

  • model (torch model) – 1D-CNN model that we created by using model1DCNN.py

  • train_loader (dataloader) – train data_loader for training

  • optimizer (torch.optimizer) – you can select the optimizer

  • epoch (int) – Epoch number

Returns

Returns training loss

Return type

[float]

main.train_optuna(trial)

This function is for optimizing the hyperparameters.

Parameters

trial (optuna.study) – This comes from optuna. Initialized study

Returns

Test loss value. In this study optuna tries to minimize this value.

Return type

test_loss [float]