Tutorials

The easiest way to get familiar with scvi-tools is to follow along with our tutorials. Many are also designed to work seamlessly in Google Colab, a free cloud computing platform. Tutorials are designed to work with the latest installable version of scvi-tools.

Note

For questions about using scvi-tools, or broader questions about modeling data, please use our forum.

Developer tutorials

Here we feature tutorials to guide you through the construction of a model with scvi-tools. For an example of how scvi-tools can be used in an independent package, see our GitHub template.

Note

For questions about developing with scvi-tools, please use our forum or gitter.

Glossary

A Model class inherits BaseModelClass and is the user-facing object for interacting with a module. The model has a train method that learns the parameters of the module, and also contains methods for users to retrieve information from the module, like the latent representation of cells in a VAE. Conventionally, the post-inference model methods should not store data into the AnnData object, but instead return “standard” Python objects, like numpy arrays or pandas dataframes.

The training plan is a PyTorch Lightning Module that is initialized with a scvi-tools module object. It configures the optimizers, defines the training step and validation step, and computes metrics to be recorded during training. The training step and validation step are functions that take data, run it through the model and return the loss, which will then be used to optimize the model parameters in the Trainer. Overall, custom training plans can be used to develop complex inference schemes on top of modules.