Closed hpages closed 4 years ago
1. Oops. Guess the test suite wasn't as exhaustive as I thought.
2. Double-oops. Though I did it right (with expand.NSBS=TRUE
) for my own functions, so dunno what I was thinking here.
No worries. I'll try to expand the test suite to cover this.
rowVars=n/(n-1)(1/n ∑▒〖x^2-¯x^2)〗,center=¯x^2 ,Does this formula hold if you specify another center @hpages ,thank you very much
I wonder if we shouldn't try to come up with a test suite that can be shared by all the packages that define matrixStats methods (currently sparseMatrixStats, DelayedArray, and DelayedMatrixStats). After all what we do when we test the correctness of the rowVars()
method for DelayedMatrix objects is very similar to what we do when we test the correctness of the rowVars()
method for xgCMatrix objects, only the input is different. So it seems that there is a lot of room for sharing here. Getting a test suite that covers all possible uses of something like rowVars()
is actually a significant amount of work and it's easy to forget to test some weird combinations of the arguments so it would be really nice to do this only once.
Anyway, probably for another day.
Hi, I don't think this code makes sense. What do you think? Looking forward to your reply
.scaled_colranks_safe <- function(x) {
out <- colRanks(DelayedArray(x), ties.method="average")
center <- (nrow(x) + 1)/2
sum.sq <- rowVars(out, center=center) * (nrow(x)-1)
sum.sq <- pmax(1e-8, sum.sq)
(out - center)/(sqrt(sum.sq) * 2)
}
@zznx please restrict your comments to LTLA/SingleR#160. If I wasn't going to answer your question there, I'm not going to answer your question here.
I'm sorry to bother you
I wonder if we shouldn't try to come up with a test suite that can be shared by all the packages that define matrixStats methods
Yes, you could imagine stuffing some setup scripts in MatrixGenerics's inst/
that define some sensible test functions, which we can retrieve and run in our unit testing framework of choice. It would need some very well-considered debugging capability when tests fail, though; this was a major PITA with the current test suite in DMS, as I had to go in and debug()
the test function, and then also figure out the exact iteration of Map
that failed.
A failure message along the lines of:
would be very nice.
(As an aside, the test suite for DMS effectively tests SMS as well, because it needs to check for correct sparse dispatch.)
@zznx,
Hard to read your formula, it didn't render very clearly. An extended variance defined for x
(a numeric vector, not a matrix, for the sake of clarity) as:
sum((x - center)^2) / (length(x) - 1)
is what it is. It has the benefit to be equal to the traditional variance when center
is set to mean(x)
and the fact that the user can choose a different center adds some nice flexibility. So I don't really understand all the dance and hesitation around this. See https://github.com/const-ae/sparseMatrixStats/issues/13. But as pointed by @LTLA your question is off-topic here.
I'll try to expand the test suite to cover this.
I gave up on this, sorry. I'd rather spend my time on working on an extensive and reusable testing framework for all the MatrixGenerics's generics. I'll actually need this very soon.
A common test suite would be brilliant. I think I tried to copy the matrixstats test suite when I initially implemented DMS, but it may have fallen behind. Making the tests more debugable is definitely important
Fixed in DelayedMatrixStats 1.13.1.
BTW I just pushed the changes to the RELEASE_3_12 branch (DelayedMatrixStats 1.12.1). Hope it's ok.
BTW I just pushed the changes to the RELEASE_3_12 branch (DelayedMatrixStats 1.12.1). Hope it's ok.
Thanks, hadn't thought of that.
This is a continuation of issue #64. Looks like even after PR #65, a few issues remain with how the
center
argument is handled.1st issue:
When
rows
is supplied,center
is not subsetted accordingly.Works as expected with an ordinary matrix:
but not with a DelayedMatrix derivative:
2nd issue:
Internal helper
.DelayedMatrix_block_rowVars()
breaks if the grid is non-trivial (i.e. has more than 1 block) and if the blocks are made of more than 1 row.Works fine with a trivial grid (single block):
but not with a grid made of 2 blocks (4 rows and 2 rows, respectively):
Note that this 2nd issue breaks the
scale()
method for DelayedMatrix objects (see https://github.com/Bioconductor/DelayedArray/issues/79).The issues described above affect all the methods with a
center
argument i.e.row/colVars()
,row/colMads()
, androw/colWeightedMads()
.I'm working on a patch.
H.
sessionInfo():