# Predicting of unassigned cells using scANVI

**URL:** <https://discourse.scverse.org/t/predicting-of-unassigned-cells-using-scanvi/1951>\
**Category:** scvi-tools\
**Tags:** scanvi, scvi\
**Created:** [December 10, 2023, 7:52pm UTC](https://discourse.scverse.org/t/predicting-of-unassigned-cells-using-scanvi/1951 "2023-12-10T19:52:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marwansha](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/marwansha/32/830_2.png) [@Marwansha](https://discourse.scverse.org/u/Marwansha)\
**Post date:** [December 10, 2023, 7:52pm UTC](https://discourse.scverse.org/t/predicting-of-unassigned-cells-using-scanvi/1951/1 "2023-12-10T19:52:26Z")

</div>

I have two questions related to scanvi and scvi model options:

Using scanvi for Predicting Unlabeled Cells:  
I’ve trained a scvi model on 1 million cells with cell type annotations. Now, I have a proportion of unlabeled cells and would like to predict their cell types using scanvi. After initializing the scanvi model, should I use scanvi\_model.predict() to achieve this?

Understanding Model Parameters:  
In the scvi model initialization, I used the following parameters:

python

model = scvi.model.SCVI(adata, n\_layers=2, n\_latent=30, gene\_likelihood=“nb”)  
I’m curious about the impact of adjusting n\_latent and gene\_likelihood. Could you explain how varying these parameters affects the output of the learning model? For example, using different values for n\_latent and choosing a different gene\_likelihood.

Here’s the code snippet I used for setting up my data:

thanks alot for your time and help

> adata=sc.read\_h5ad(“/pasteur/zeus/projets/p02/LabExMI/singleCell/V3/scRNA\_NS\_IAV\_COV/results/merged\_object/adata.h5ad”)  
> adata=adata[:,highly\_variable]  
> scvi.model.SCVI.setup\_anndata(adata, layer = “counts”,  
> categorical\_covariate\_keys=[“library”],  
> continuous\_covariate\_keys=[‘pct\_counts\_mt’, ‘total\_counts’, “pct\_counts\_RP”])  
> model.train()  
> adata.obsm[‘X\_scVI’] = model.get\_latent\_representation()  
> adata.layers[‘scvi\_normalized’] = model.get\_normalized\_expression()  
> scanvi\_model = scvi.model.SCANVI.from\_scvi\_model(  
> model,  
> adata=adata,  
> labels\_key=“cell\_type”,  
> unlabeled\_category=“unassigned”,  
> )  
> adata.obsm[SCANVI\_LATENT\_KEY] = scanvi\_model.get\_latent\_representation(adata)
