theislab / moscot

Multi-omic single-cell optimal transport tools
https://moscot-tools.org
BSD 3-Clause "New" or "Revised" License
112 stars 9 forks source link

_spatial_norm_callback implementation #698

Closed selmanozleyen closed 4 months ago

selmanozleyen commented 4 months ago

hi @giovp I am writing this issue to document one of the commits I will make in https://github.com/theislab/moscot/pull/696. At this point it will be hard for me to separate that commit in the PR and it will be a small discussion compared to how big the PR will be. I want to discuss this implementation.

https://github.com/theislab/moscot/blob/0892c6b1cd380f0657bec1fe3ffabe5342cac544/src/moscot/base/problems/problem.py#L615-L634

First Issue: Typo

first of all I will fix the type from attrs to attr

Second Issue: Standardization

but I also want to ask whether

spatial = (spatial - spatial.mean()) / spatial.std()

is a correct standardization, shouldn't it be

spatial = (spatial - spatial.mean(axis=0,keepdims=True)) / spatial.std(axis=0,keepdims=True)

since we'd like each feature to be gaussian units right? or am I missing something?

giovp commented 4 months ago

hi @selmanozleyen , yes the axis=0 is correct for mean, not for std as it would introduce a distortion in the axis, I've added the fix in #697