topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.61k stars 634 forks source link

Fix test flakiness #1351

Open MichaelChirico opened 11 months ago

MichaelChirico commented 11 months ago

Closes #1350

Alternatively, we can use a set.seed(), but keeping this test random does make it slightly more interesting.

I also tried with n=150, it fails ~0.05% of the time. I didn't notice a speed difference on n=150/n=200, so I stuck with the safer n=200.

MichaelChirico commented 11 months ago

Another option is to deterministically ensure 1:15 are present, e.g. instead of sample.int(15, 100, TRUE), we do c(1:15, sample.int(15, 85, TRUE)).