You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
actionet.tools.scale differs from R’s base::scale with disabled or explicit centering #2
actionet.tools.scale is documented as mirroring R’s base::scale(). With scale=True, it currently divides by the sample standard deviation around the column mean, even when centering is disabled or an explicit centre is supplied.
R instead divides each column, after any centering, by its root mean square. These calculations agree when center=True, but generally differ when center=False or a centre vector is supplied. Calls with scale=False or an explicit scale vector are unaffected.
The same discrepancy occurs with one-dimensional and sparse input. The expected numbers above were calculated from R’s documented scale formula; R itself was not run for this reproduction.
Against a reference implementation of that formula, upstream main (e9e33a7) matches in the default and scale=False matrix cases, but differs in the center=False and explicit-centre cases.
Impact
The in-repository run_actionet pipeline calls scale() with its defaults, so this issue does not claim a change to its layouts. It affects direct callers using scale=True with disabled or explicit centering, whose outputs can differ from R.
Expected behavior
With scale=True, compute the scaling factor from each column after centering, using sqrt(sum(x²) / (n - 1)) for the cases above, as specified by R’s base::scale documentation.
Activity