Configure the model architecture and training parameters, and start training

This section shows how to configure the model architectures and training hyperparameters using in the UNAGI.

The model architecutures includes

  • The number of fully connected layers in the VAE of UNAGI.

  • The number of neurons for each fully connected layer.

The training hyperparameters includes

  • The learning rate of graph VAE.

  • The learning rate of the discriminator.

  • The batch size.

  • The number of iterations to run the UNAGI tool.

  • The number of epochs for the inital iteration.

  • The number of eacphs for the iteratively training iterations.

  • The gene expression distribution of the input single-cell dataset.

  • Using GPU or not.

Register the data used for training.

import warnings
warnings.filterwarnings('ignore')
from UNAGI import UNAGI
unagi = UNAGI()
unagi.setup_data('PATH_TO_YOUR_DATA',total_stage=4,stage_key='stage') # total_stage is the number of time-points of your data, stage_key is the column name of the stage in your data

Configure the model architecture.

hidden_dim = 128 # neurons of the hidden dimension of the VAE
latent_dim = 32 # neurons of the latent dimension of the VAE
graph_dim = 512 # neurons of the output of graph convolutional network

Configure the training hyperparameters.

task_name = 'example'
gene_expression_distribution = 'ziln' # using zero-inflated lognormal distribution
GPU=True # enable GPU
device='cuda:0' # GPU device
training_epochs_initial = 10 # training epochs for initial stage
training_epochs_iterative = 8 # training epochs for iterative stages
maximum_iteration = 3 # maximum number of iterations
batch_size = 256 # batch size
learning_rate_vae = 0.0001 # learning rate for VAE
learning_rate_discriminator = 0.0005 # learning rate for discriminator (GAN)
unagi.setup_training(task=task_name,dist=gene_expression_distribution,hidden_dim=hidden_dim,latent_dim=latent_dim,graph_dim=graph_dim,GPU=GPU,device=device,epoch_initial=training_epochs_initial,epoch_iter=training_epochs_iterative,max_iter=maximum_iteration,BATCHSIZE=batch_size,lr=learning_rate_vae,lr_dis=learning_rate_discriminator)

Start training

Running the UNAGI tool requires to specify the directory of iDREM software.

iDREM_Path = 'iDREM_Dir' # path to iDREM directory
unagi.run_UNAGI(iDREM_Path)