SC2Spa.tl.Train_transfer
- SC2Spa.tl.Train_transfer(adata, root, model_root, sparse=True, polar=True, CT='A', lrr_patience=20, ES_patience=50, min_lr=1e-05, epoch=500, batch_size=4096, NLFT=6, subLayer=False)
Finetune location prediction model (FCNN) on a specific cell type A model will be trained and saved to root + ‘SI_’ + CT + ‘.h5’ The predicted coordinates of single cells will be saved in adata_query.obsm[‘spatial_mapping’] The predicted coordinates of beads will be saved in adata_ref.obs[‘spatial_mapping’] Fine mapping information will be saved in adata_ref.obs[‘FM’] and adata_query.obs[‘FM’]. True if a cell/bead was mapped, otherwise False.
Parameters
- adata
An anndata object that contains the gene expression matrix of the target type of cells. The gene expression matrix should be the shape of (cell, gene). Spatial information should be stored in adata_ref.obsm[‘spatial’] in np.array format
- sparse
True if gene expression is saved in sparse format, otherwise False
- model_root
The path of a trained model.
- root
the root path to save the model
- name
the name used to save the model
- lrr_patience
The patience for learning rate reduction
- min_lr
minimum learning rate
- ES_patience
The patience for early stopping
- sublayer
whether to finetune part of the neural network
- NLFT
the number of layers that are finetuned. Layers are counted from the last layer to the first layer
Returns
- model
The finetuned FCNN