# Batch Integration Parameter Tuning

**URL:** <https://discourse.scverse.org/t/batch-integration-parameter-tuning/315>\
**Category:** scvi-tools\
**Tags:** integration, gene-selection, scvi, modeling\
**Created:** [March 2, 2022, 12:21am UTC](https://discourse.scverse.org/t/batch-integration-parameter-tuning/315 "2022-03-02T00:21:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abbass2](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/abbass2/32/884_2.png) [@abbass2](https://discourse.scverse.org/u/abbass2)\
**Post date:** [March 2, 2022, 12:21am UTC](https://discourse.scverse.org/t/batch-integration-parameter-tuning/315/1 "2022-03-02T00:21:50Z")

</div>

Hello,

Great tool, thanks for all your efforts…couple questions below.

I am integrating ~500K cells from \> 40 donors, and I am interested in parameter tuning for the model. I’m new to neural networks, but it seems like the output (clustering, markers, UMAP) would be primarily affected by the number of HVGs, number of layers, and final dimensions. I was wondering what your thoughts were on toggling these three inputs for model refinement. My understanding is increasing layers should tease out more hidden interactions, while increasing dimensions is essentially allocating more space to store variability/patterns?

Does your model automatically consider variance from sequencing depth or should users specify number of UMIs as a continuous covariate?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![adamgayoso](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/adamgayoso/32/100_2.png) [@adamgayoso](https://discourse.scverse.org/u/adamgayoso)\
**Post date:** [March 2, 2022, 11:28pm UTC](https://discourse.scverse.org/t/batch-integration-parameter-tuning/315/2 "2022-03-02T23:28:48Z")

</div>

> [@abbass2](#):
>
> My understanding is increasing layers should tease out more hidden interactions, while increasing dimensions is essentially allocating more space to store variability/patterns?

Yes, though it’s not always so simple. There are pecularities when training Variational autoencoders related to inactive dimensions of the “bottleneck” layer. But your thought process is very reasonable.

What you could do is define some relevant metrics to you (like in [scIB](https://www.nature.com/articles/s41592-021-01336-8)) and then do hyperparameter optimization using Ray Tune or other packages or a simple grid search.

> [@abbass2](#):
>
> Does your model automatically consider variance from sequencing depth or should users specify number of UMIs as a continuous covariate?

The model automatically uses the observed library size of the gene expression data you supply (as it’s counts, just takes the sum). In the newest release you can provide your own `size_factor_key` to `setup_anndata` (on the linear scale!)
