# Data scaling for cytovi

**URL:** <https://discourse.scverse.org/t/data-scaling-for-cytovi/3911>\
**Category:** scvi-tools\
**Created:** [January 11, 2026, 10:54pm UTC](https://discourse.scverse.org/t/data-scaling-for-cytovi/3911 "2026-01-11T22:54:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghar1821](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/ghar1821/32/1526_2.png) [@ghar1821](https://discourse.scverse.org/u/ghar1821)\
**Post date:** [January 11, 2026, 10:54pm UTC](https://discourse.scverse.org/t/data-scaling-for-cytovi/3911/1 "2026-01-11T22:54:51Z")

</div>

Hi guys,

In cytovi tutorial, i see a data scaling step for each batch `cytovi.scale(adata_batch1)` which by default scale the data to range between 0-1 using sklearn’s `MinMaxScaler`.

Post correction, what is the best way to “untransform” the range to match the original range? One can run `transform` using the fitted `MinMaxScaler` object, but then should we:

1. Run `transform` per batch using the `MinMaxScaler` object fitted for that batch? Or
2. Fit (but not transform) a new `MinMaxScaler` object based on data from all batches, then post correction run `transform` using this fitted `MinMaxScaler` object? Or
3. Some other suggestion

Thanks!

---

<div class="post-metadata">

**Author:** ![ori-kron-wis](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/ori-kron-wis/32/1099_2.png) [@ori-kron-wis](https://discourse.scverse.org/u/ori-kron-wis)\
**Post date:** [January 13, 2026, 8:03am UTC](https://discourse.scverse.org/t/data-scaling-for-cytovi/3911/2 "2026-01-13T08:03:06Z")

</div>

In my opinion, you should save MinMaxScaler objects per batch before you continue to use the internal cytovi scale function, then you can use them to untransform per batch, post-analysis.

Of course, you can also have this kind of object for all data put together; it all depends on what you want to do following it.

@florianingelfinger, any other thoughts?

---

<div class="post-metadata">

**Author:** ![SofieVG](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/sofievg/32/1569_2.png) [@SofieVG](https://discourse.scverse.org/u/SofieVG)\
**Post date:** [January 15, 2026, 3:16pm UTC](https://discourse.scverse.org/t/data-scaling-for-cytovi/3911/3 "2026-01-15T15:16:40Z")

</div>

The problem with untransforming per batch, post-analysis, is that then differences between batches are re-introduced (i.e. by applying a different transformation on each batch, the batches will not look similar anymore, even if they were well aligned by cytovi).

What we are considering now, is to apply batch specific scaling, do the alignment with cytovi, and then untransform with the scaler object from one of the batches. In theory, if you suggest that can be used on the data from that specific batch, it should also be suited to untransform the others as those will look very similar after the alignment.

This avoids learning a separate scaler, and feels closer to the recommended pipeline of first applying a scaling step per batch rather than doing a single scaling across all samples.

Further thoughts are of course still welcome.
