Repository navigation
Fix t-tests when variance is zero - #621
Conversation
|
Someone should review this before it's merged. I think this won't cause any problems, but I'm also not too familiar with the DE code. |
|
I wonder why this wasn't done in the first place. Is scipy not already a dependency of scanpy? Or is this slower than the initial implementation? |
|
Looks great! I wasn't aware of this high-dimensional version of a t-test in Scipy, which seems to be as efficient as the current implementation. I only investigated thoroughly for Wilcoxon rank and found that Scipy doesn't have a scalable version to offer. But yes, this will get merged after 1.4.1. |
|
1.4.1 is out, are we sure this is as scalable as it was before and not a backwards breaking change. If yes, we can merge immediately. |
|
I'm not completely sure this doesn't break anything, but the regression tests pass. The internal code is very similar, so I'm not too worried about these changes. It does look like it's (very) slightly slower. Running this a thousand times for pbmc68k dataset took ~2.3% longer (about 1.4 ms per run) than the previous version. That said, we're very inefficient about mean and variance calculation, so I think that's a better place to optimize. Edit: I've force pushed to fix some minor formatting issues (trailing white space, blank line, typo) that I didn't think deserved it's own commit. |
|
Great! 2.3% is nothing... |
Fix t-tests when variance is zero
Just a quick fix, should probably replace most of this code with
scipy.stats.ttest_ind/scipy.stats.stats.ttest_ind_from_statswithequal_var=False.