Teichlab / celltypist

A tool for semi-automatic cell type classification
https://www.celltypist.org/
MIT License
260 stars 40 forks source link

How to update the model #32

Closed hxpGit512 closed 1 year ago

hxpGit512 commented 1 year ago

Dear Celltypist Team,

If I have a new annotated dataset, how can I train and update it into the existing model ?

Looking forward to your reply!

ChuanXu1 commented 1 year ago

@hxpGit512, you can check the Usage (Supplemental guidance -> generate a custom model) for details on how to train a model and save it into the existing model list. Also check out the celltypist.train function for the training parameters.

As an example, if you have an AnnData with highly variable genes, you can train the model using model = celltypist.train(adata[:, adata.var.highly_variable], 'cell_type_column', n_jobs = -1, max_iter = 500, check_expression = False) followed by model.write(f"{celltypist.models.models_path}/some_model_name.pkl")

hxpGit512 commented 1 year ago

@ChuanXu1 , Multiple annotated datasets can be trained in batches and then incorporated into one model ?

ChuanXu1 commented 1 year ago

@hxpGit512, do you mean multiple datasets with different annotations? If yes, you need to train and save each of them separately.