topepo/caret

classDist test is flaky

MichaelChirico opened this issue · 0 comments

expect_true(length(distData$values) == length(unique(y)) - 1)

res <- replicate(1e4, {
  trainSet <- sample(1:150, 100)
  x = iris[trainSet, 1:4]
  y = as.numeric(iris$Species[trainSet])
  groups = 4

  distData <- classDist(x, y, pca = FALSE, groups = groups)
  length(distData$values) == length(unique(y)) - 1
})
table(res)
# res
# FALSE  TRUE 
#    21  9979 

How can we decrease the flakiness here?