Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size factors in guide #1361

Merged
merged 2 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/user_guide/models/multivi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The latent variables, along with their description are summarized in the followi
- Low-dimensional representation capturing the state of a cell.
- N/A
* - :math:`\rho_n \in \Delta^{G-1}`
- Denoised/normalized gene expression.
- Denoised/normalized gene expression. This is a vector that sums to 1 within a cell, unless `size_factor_key is not None` in :class:`~scvi.model.MULTVI.setup_anndata`, in which case this is only forced to be non-negative via softplus.
- ``px_scale``
* - :math:`\ell_n \in (0, \infty)`
- Library size for RNA.
Expand All @@ -108,7 +108,7 @@ The latent variables, along with their description are summarized in the followi
- Accessibility probability estimate
- N/A
* - :math:`\ell_n \in \left[0,1\right]`
- Cell-wise scaling factor
- Cell-wise scaling factor. Learned, but can be set manually with `size_factor_key` in :class:`~scvi.model.MULTIVI.setup_anndata`.
- ``d``
* - :math:`r_j \in \left[0,1\right]`
- Region-wise scaling factor
Expand Down
6 changes: 3 additions & 3 deletions docs/user_guide/models/scanvi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ cellular state as a continuous, low-dimensional random variable, and has the sam
However, the prior for this variable takes into account the partial cell-type information to better structure the latent space.

The rest of the model closely follows scVI. In particular, it represents the library size as a random variable,
and gene expression likelihoods as negative binomial distributions parameterized by functions of :math:`z_n, l_n`,
and gene expression likelihoods as negative binomial distributions parameterized by functions of :math:`z_n, \ell_n`,
condition to the batch assignments :math:`s_n`.

.. figure:: figures/scanvi_pgm.png
Expand Down Expand Up @@ -105,10 +105,10 @@ scANVI assumes the following factorization for the inference model
:nowrap:

\begin{align}
q_\eta(z_n, l_n, u_n, c_n \mid x_n)
q_\eta(z_n, \ell_n, u_n, c_n \mid x_n)
=
q_\eta(z_n \mid x_n)
q_\eta(l_n \mid x_n)
q_\eta(\ell_n \mid x_n)
q_\eta(c_n \mid z_n)
q_\eta(u_n \mid c_n, z_n)
\end{align}
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/models/scvi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ The latent variables, along with their description are summarized in the followi
- Low-dimensional representation capturing the state of a cell.
- N/A
* - :math:`\rho_n \in \Delta^{G-1}`
- Denoised/normalized gene expression.
- Denoised/normalized gene expression. This is a vector that sums to 1 within a cell, unless `size_factor_key is not None` in :class:`~scvi.model.SCVI.setup_anndata`, in which case this is only forced to be non-negative via softplus.
- ``px_scale``
* - :math:`\ell_n \in (0, \infty)`
- Library size for RNA. Here it is modeled as a latent variable, but the recent default for scVI is to treat library size as observed, equal to the total RNA UMI count of a cell. This can be controlled by passing ``use_observed_lib_size=False`` to :class:`~scvi.model.SCVI`.
- Library size for RNA. Here it is modeled as a latent variable, but the recent default for scVI is to treat library size as observed, equal to the total RNA UMI count of a cell. This can be controlled by passing ``use_observed_lib_size=False`` to :class:`~scvi.model.SCVI`. The library size can also be set manually using `size_factor_key` in :class:`~scvi.model.SCVI.setup_anndata`.
- N/A
* - :math:`\theta_g \in (0, \infty)`
- Inverse dispersion for negative binomial. This can be set to be gene/batch specific for example (and would thus be :math:`\theta_{kg}`), by passing ``dispersion="gene-batch"`` during model intialization. Note that ``px_r`` also refers to the underlying real-valued torch parameter that is then exponentiated on every forward pass of the model.
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/models/totalvi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The latent variables, along with their description are summarized in the followi
- Low-dimensional representation capturing joint state of a cell
- N/A
* - :math:`\rho_n \in \Delta^{G-1}`
- Denoised/normalized gene expression,
- Denoised/normalized gene expression. This is a vector that sums to 1 within a cell, unless `size_factor_key is not None` in :class:`~scvi.model.TOTALVI.setup_anndata`, in which case this is only forced to be non-negative via softplus.
- ``px_["scale"]``
* - :math:`\alpha_n \in [1, \infty)^T`
- Foreground scaling factor for proteins, identifies the mixture distribution (see below)
Expand All @@ -124,7 +124,7 @@ The latent variables, along with their description are summarized in the followi
- Probability of background for each protein
- ``py_["mixing"]`` (logits scale).
* - :math:`l_n \in (0, \infty)`
- Library size for RNA. Here it is modeled as a latent variable, but the recent default for totalVI is to treat library size as observed, equal to the total RNA UMI count of a cell. This can be controlled by passing ``use_observed_lib_size=False`` to :class:`~scvi.model.TOTALVI`.
- Library size for RNA. Here it is modeled as a latent variable, but the recent default for totalVI is to treat library size as observed, equal to the total RNA UMI count of a cell. This can be controlled by passing ``use_observed_lib_size=False`` to :class:`~scvi.model.TOTALVI`. The library size can also be set manually using `size_factor_key` in :class:`~scvi.model.TOTALVI.setup_anndata`.
- N/A
* - :math:`\beta_{nt} \in (0, \infty)`
- Protein background intensity. Used twice to identify the protein mixture model.
Expand Down