Skip to content

Commit

Permalink
Merge branch 'main' into rfe_importance
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Dec 15, 2023
2 parents 7ba6ef4 + 9377188 commit 52a63c2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ importFrom(bbotk,trms)
importFrom(mlr3misc,clbk)
importFrom(mlr3misc,clbks)
importFrom(mlr3misc,mlr_callbacks)
importFrom(stats,sd)
importFrom(utils,bibentry)
importFrom(utils,combn)
importFrom(utils,head)
14 changes: 14 additions & 0 deletions R/bibentries.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,19 @@ bibentries = c(
journal = "Machine Learning",
author = "Isabelle Guyon and Jason Weston and Stephen Barnhill and Vladimir Vapnik",
year = "2002"
),

kuhn2013 = bibentry("Inbook",
author = "Kuhn, Max and Johnson, Kjell",
chapter = "Over-Fitting and Model Tuning",
title = "Applied Predictive Modeling",
year = "2013",
publisher = "Springer New York",
address = "New York, NY",
pages = "61--92",
isbn = "978-1-4614-6849-3",
doi = "10.1007/978-1-4614-6849-3_4",
url = "https://doi.org/10.1007/978-1-4614-6849-3_4"
)
)

5 changes: 4 additions & 1 deletion R/mlr_callbacks.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ load_callback_svm_rfe = function() {
#' @description
#' Selects the smallest feature set within one standard error of the best as the result.
#'
#' @source
#' `r format_bib("kuhn2013")`
#'
#' @examples
#' clbk("mlr3fselect.one_se_rule")
#'
Expand All @@ -142,7 +145,7 @@ load_callback_one_se_rule = function() {
on_result = function(callback, context) {
archive = context$instance$archive
data = as.data.table(archive)
data[, n_features := map(features, length)]
data[, "n_features" := map(get("features"), length)]

# standard error
y = data[[archive$cols_y]]
Expand Down
3 changes: 2 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#' @import bbotk
#' @importFrom R6 R6Class
#' @importFrom utils combn head
#' @importFrom stats sd
"_PACKAGE"

.onLoad = function(libname, pkgname) {
# nocov start
utils::globalVariables(c("super", "self"))
utils::globalVariables(c("super", "self", "n_features"))

# reflections
x = utils::getFromNamespace("bbotk_reflections", ns = "bbotk")
Expand Down
7 changes: 7 additions & 0 deletions man/mlr3fselect.one_se_rule.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test_FSelectInstanceSingleCrit.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test_that("always include variable works", {
task = task,
learner = learner,
resampling = resampling,
measure = msr("classif.ce"),
measures = msr("classif.ce"),
terminator = trm("evals", n_evals = 100),
store_models = TRUE
)
Expand All @@ -105,7 +105,7 @@ test_that("always include variables works", {
task = task,
learner = learner,
resampling = resampling,
measure = msr("classif.ce"),
measures = msr("classif.ce"),
terminator = trm("evals", n_evals = 100),
store_models = TRUE
)
Expand Down

0 comments on commit 52a63c2

Please sign in to comment.