Rattle in macOS Cartalina 10.15.6 unable to evaluate error matrix results from boost model

101 Views Asked by At

Rattle in macOS Cartalina 10.15.6 gives error message: "The supplied actual and predicted must have the same levels." when evaluating model performance using boost method under evaluate tab.

Error message from r console: Error in rattle::errorMatrix(crs$dataset[crs$test, c(crs$input, crs$target)]$TFC_churn, : The supplied actual and predicted must have the same levels.

How to rectify?

matrix

Log code:

enter image description here

1

There are 1 best solutions below

5
On

This might have to do with your input data. Not exactly clear, what you are doing (maybe add soe additional info) but:

The supplied actual and predicted must have the same levels.

This is a typical error message, when your test dataset does not match the train dataset.

Probably test and train have the same variables, but with factor variables it is often also required that the factor levels match each other.

For example:

train:

 gender: factor -   male/female

test:

gender: factor - male/female/unknown

Could give you problems, since in the test set there is suddenly a new factor level, the model has not seen before and does not know what to do with it.

Often it is enough to just add this level to the variable of the train set. (even if there is no instance of it)