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

feat: add callbacks for resample and benchmark #1214

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

be-marc
Copy link
Member

@be-marc be-marc commented Nov 21, 2024

No description provided.

@be-marc
Copy link
Member Author

be-marc commented Nov 21, 2024

callback = callback_workhorse(
  id = "mlr3.selected_features",
  on_workhorse_before_result = function(callback, context) {
    context$env$learner$state$selected_features = setdiff(context$env$learner$model$frame$var, "<leaf>")
  }
)

learner = lrn("classif.rpart")
task = tsk("iris")
resampling = rsmp("cv", folds = 3)

rr = resample(task, learner, resampling, callbacks = callback)

rr$learners[[1]]$state$selected_features

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.

1 participant