Skip to content

un-informative errors for small data sets #73

@tdhock

Description

@tdhock

hi @bethatkinson I ran into an error from rpart when using it to train/predict on a small classification data set (in which cross-validation makes even smaller data sets where there can be missing classes), tdhock/mlr3resampling#80

A simpler way to reproduce the same issue is

> rpart::rpart(y~x, data.frame(y=factor("pos"),x=1:2))
Error in cbind(yval2, yprob, nodeprob) : 
  number of rows of matrices must match (see arg 2)

I would have expected a more informative error such as, "y has only one class, but at least two are required"

Similarly,

> rpart::rpart(y~x, data.frame(y=factor("pos"),x=1))
Error in yprob[, i] : subscript out of bounds

an error which would be more helpful for the user: "data has only one row, but rpart needs at least two"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions