MLJBase.jl icon indicating copy to clipboard operation
MLJBase.jl copied to clipboard

`partition` actually *does* allow `shuffle=true` if `stratify != nothing`?

Open dpaetzel opened this issue 4 months ago • 1 comments

The docs of partition say that

stratify=nothing: if a vector is specified, the partition will match the stratification of the given vector. In that case, shuffle cannot be false`.

However,

  1. shuffle is internally set to true and a shuffle performed if an RNG is supplied, even if shuffle=false (i.e. the docs should probably also say don't supply an RNG either?)
  2. I'm fairly confident, that the stratify vector is actually correctly indexed into (here) even if shuffle=true. (Ideally, someone with more code familiarity would quickly look over this, too, though—me being fairly confident may not be enough for the standards of this repo.)

If I'm mistaken, then sorry for the noise.

If not, then it may make sense to update the docs (in either case)?

dpaetzel avatar Sep 02 '25 17:09 dpaetzel

Thanks @dpaetzel for your post. I've not had a chance to look into this yet but thank you in advance for your patience.

@tlienart If you still remember, are you able to address this point?

ablaom avatar Sep 09 '25 05:09 ablaom