-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
row/colVars()
and row/colSds()
methods for xgCMatrix objects silently ignore the supplied center
#13
Comments
Hi Hervé, I understood Henrik in HenrikBengtsson/matrixStats#183 that center must be an honest center estimate of the column means:
Accordingly, I could of course replicate the behavior of My thinking for not implementing the |
Hi Constantin, My use case is to efficiently compute:
I was hoping I could do it with:
which works fine when But that's ok, I guess I can use:
instead. Doesn't seem that it would be too hard to generalize this to an arbitrary
Anyways, at the very least the methods in sparseMatrixStats should issue a warning or an error that Thanks! P.S.: FWIW my use case comes from here: https://github.com/Bioconductor/DelayedArray/blob/aa9a74556f5c36307ceb638eb31199477139fea8/R/DelayedArray-utils.R#L857 |
@hpages, I don't think this is a good idea. There are at least two different ways to calculate the variance and it's not safe to make assumptions on which one is used. This is normally not a problem when there's no |
I agree. Better not having it than having it do something that is not well defined. |
I'll just mention that I've been obsessively using library(matrixStats)
y <- matrix(rnorm(1e8), ncol=1000)
system.time(out <- rowVars(y))
## user system elapsed
## 0.371 0.000 0.371
rm <- rowMeans(y)
system.time(out2 <- rowVars(y, center=rm))
## user system elapsed
## 0.298 0.144 0.441 (As an aside: in this case, using Anyway, the tl;dr is that there doesn't seem to be an unambiguous performance advantage to using |
See for example the definition of the
rowVars()
method:Here is a concrete example using a dgCMatrix object:
center
not supplied:center
supplied:Thanks,
H.
sessionInfo():
The text was updated successfully, but these errors were encountered: