Yes it is a valid result for sampling with replacement, the question is whether sampling with replacement is a valid way to do “rarefaction” conceptually.

On Mar 25, 2014, at 10:25 AM, Greg Caporaso <notifications@github.com<mailto:notifications@github.com>> wrote:


In skbio/maths/subsample.py:

>
> -    Returns `counts` if `n` is equal to or larger than the number of items in
> -    `counts`.
> +    Returns a copy of `counts` if `n` is equal to or larger than the number of


Just to summarize what the specific question is: if n == counts.sum(), should counts be returned as is?

Currently the behavior is that counts is returned as-is for sampling with replacement and without replacement. I agree that this is correct for sampling without replacement, and that is the default in QIIME. For sampling with replacement, you should be able to have a different count vector, so I think returning counts as-is is actually wrong, but this specific use case has probably come up very infrequently, if ever, in QIIME. For example, if you run subsample([1,1,1], n=3, replace=True) shouldn't [2,1,0] be a valid result?

As discussed here<https://github.com/pycogent/pycogent/issues/53> this code was originally added in a rush, so I think it was just an oversight. So, I think we should modify the behavior of just returning counts when replace==True and n = counts.sum().

Note that this issue is independent of performance benchmarking issues, etc, that were also brought up in this discussion.

—
Reply to this email directly or view it on GitHub<https://github.com/biocore/scikit-bio/pull/206/files#r10938619>.