sett.m(0, "... filter highly varying genes by dispersion and mean")
X = data // proceed with data matrix
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler(with_mean=False).partial_fit(X)mean = scaler.mean_
var = scaler.var_ * (X.shape[0]/(X.shape[0]-1)) // use R convention (unbiased estimator)
dispersion = var / (mean + 1e-12)
if log: // logarithmized mean as in Seurat
dispersion[dispersion == 0] = np.nan
After Change
return adata if copy else None
logg.m("... filter highly varying genes by dispersion and mean", r=True, end=" ")
X = data // proceed with data matrix
mean, var = _get_mean_var(X)
// now actually compute the dispersion
dispersion = var / mean
if log: // logarithmized mean as in Seurat