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

Implemented optimism bootstrap #544

Merged
merged 3 commits into from
Dec 5, 2016
Merged

Implemented optimism bootstrap #544

merged 3 commits into from
Dec 5, 2016

Conversation

asardaes
Copy link
Contributor

@asardaes asardaes commented Dec 2, 2016

Some time ago I implemented the optimism bootstrap to test it. I also added a method boot_all to get all bootstrap estimates in one run. If you want to include these, you can merge this branch. I added the reference to the documentation of trainControl. There is some more info in this post too.

I also added the .onUnload function, which should be used when a package uses compiled code (see good practice here)

@coveralls
Copy link

coveralls commented Dec 2, 2016

Coverage Status

Coverage decreased (-0.03%) to 16.405% when pulling 78cc0d7 on asardaes:boot into 8456f03 on topepo:master.

@topepo
Copy link
Owner

topepo commented Dec 5, 2016

Looks great. Thanks

@topepo topepo merged commit 63194ca into topepo:master Dec 5, 2016
@topepo
Copy link
Owner

topepo commented Dec 5, 2016

Uh actually, there is a bug. The last call generated an error of Error in { : task 1 failed - "undefined columns selected".

library(caret)

set.seed(24)
dat <- twoClassSim(1000)

set.seed(34521)
opt_acc <- train(Class ~ ., data = dat, 
                 method = "svmRadial",
                 preProc = c("center", "scale"),
                 tuneLength = 10,
                 trControl=trainControl(method = "optimism_boot"))

set.seed(34521)
opt_acc_probs <- train(Class ~ ., data = dat, 
                       method = "svmRadial",
                       preProc = c("center", "scale"),
                       tuneLength = 10,
                       trControl=trainControl(method = "optimism_boot", 
                                              classProbs = TRUE))
set.seed(34521)
opt_roc <- train(Class ~ ., data = dat, 
                 method = "svmRadial",
                 preProc = c("center", "scale"),
                 tuneLength = 10,
                 metric = "ROC",
                 trControl=trainControl(method = "optimism_boot", 
                                        classProbs = TRUE,
                                        summaryFunction = twoClassSummary))

@asardaes
Copy link
Contributor Author

asardaes commented Dec 5, 2016

In twoClassSummary there is the following line:

rocAUC <- ModelMetrics::auc(ifelse(data$obs == lev[2], 0, 1), data[, lvls[1]])

It seems that lvls[1] = "Class1", but the columns of data are "pred", "obs", "rowIndex" and "y". That's why there's a "undefined columns selected" error. I'm not sure if I should change that line, the data itself seems to be fine though.

EDIT: nevermind, I'm not adding the probValues columns correctly, I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants