Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in predictions due to recent change in data.table #2578

Closed
danielhorn opened this issue Apr 30, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@danielhorn
Copy link
Contributor

commented Apr 30, 2019

data.table changed its behaviour wrt. rbind by name/position. Recent version issue a message about this, e.g. if you run this code:

set.seed(123)
lrn = makeLearner("classif.svm", predict.type = "prob")
task = iris.task
ctrl = makeTuneControlRandom(maxit = 2)
ps = makeParamSet(makeNumericParam("cost", lower = 0.01, upper = 0.1))
lrn = makeTuneWrapper(lrn, cv3, par.set = ps, control = ctrl)
resample(lrn, task, cv3)

This leads to errors down the analysis, where probabilites are not joint corretly together in prediction objects. I.e., probabiltites for the first class where rbinded to the column for the 2nd class, and vice versa. See

rbindlist(lapply(seq_along(pr.te), function(X) cbind(pr.te[[X]]$data, iter = X, set = "test"))),
.

To turn the message into an error, you can set the option options(datatable.rbindlist.check="error").

@mllg

This comment has been minimized.

Copy link
Member

commented May 2, 2019

Here is a snippet which demonstrates that the probabilities are incorrectly aggregated:

set.seed(123)
lrn = makeLearner("classif.svm", predict.type = "prob")
task = sonar.task

rr = resample(lrn, task, cv3)

pred = rr$pred
calculateConfusionMatrix(pred)
pred = setThreshold(pred, 0.5)
calculateConfusionMatrix(pred)

@mllg mllg closed this in #2579 May 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.