Skip to content

Commit 0fe9b80

Browse files
authored
fix: align the documented arguments with the signatures (#190)
* `as.data.table.EnsembleFSResult()` documented a `benchmark_result` argument that did not exist. It is implemented now, so the task, learner and resampling columns can be omitted. * The `$print()` methods documented `@param ... (ignored)` but declared `print = function()`, so `print(archive, digits = 3)` errored with `unused argument`. * `ArchiveAsyncFSelect$new()` documented a `check_values` argument that the constructor does not have. * `embedded_ensemble_fselect()` documented a default for `measure`, which has none. * `AutoFSelector$print()` was missing its `@description` tag.
1 parent e9dfcc8 commit 0fe9b80

16 files changed

Lines changed: 90 additions & 22 deletions

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# mlr3fselect (development version)
22

33
* fix: `ArchiveAsyncFSelect` pushed results with the removed `rush::Rush$push_results()` method.
4+
* fix: `as.data.table()` on an `EnsembleFSResult` accepts the documented `benchmark_result` argument now to omit the task, learner and resampling columns (#190).
5+
* fix: The `$print()` methods of `ArchiveBatchFSelect`, `ArchiveAsyncFSelect`, `ArchiveAsyncFSelectFrozen`, `AutoFSelector` and `FSelector` errored with `unused argument` when arguments such as `digits` were passed (#190).
46
* fix: `fs("rfecv")` had the same label as `fs("rfe")`, so both were indistinguishable in `as.data.table(mlr_fselectors)`. Its manual page also instructed to construct it with `fs("rfe")` (#191).
57
* fix: `AutoFSelector$train()` did not check the row ids of an instantiated inner resampling for cross-validation and reported a wrong set number for holdout (#197).
68
* fix: The `mlr3fselect.svm_rfe` callback accepted support vector machines without a `type` or `kernel` setting, although only `type = "C-classification"` and `kernel = "linear"` are supported. The callback now also errors on multi-class tasks for which the importance scores are not defined (#173).

R/ArchiveAsyncFSelect.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ ArchiveAsyncFSelect = R6Class(
4747
public = list(
4848
#' @description
4949
#' Creates a new instance of this [R6][R6::R6Class] class.
50-
#'
51-
#' @param check_values (`logical(1)`)\cr
52-
#' If `TRUE` (default), feature subsets are check for validity.
5350
initialize = function(
5451
search_space,
5552
codomain,
@@ -123,7 +120,7 @@ ArchiveAsyncFSelect = R6Class(
123120
#' Printer.
124121
#'
125122
#' @param ... (ignored).
126-
print = function() {
123+
print = function(...) {
127124
cat_cli(cli_h1("{format(self)} with {.val {self$n_evals}} evaluations"))
128125
print(
129126
as.data.table(

R/ArchiveAsyncFSelectFrozen.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ ArchiveAsyncFSelectFrozen = R6Class(
8383
#' Printer.
8484
#'
8585
#' @param ... (ignored).
86-
print = function() {
86+
print = function(...) {
8787
cat_cli(cli_h1("{.cls {class(self)[1L]}} with {.val {self$n_evals}} evaluations"))
8888
print(
8989
as.data.table(

R/ArchiveBatchFSelect.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ ArchiveBatchFSelect = R6Class(
155155
#' Printer.
156156
#'
157157
#' @param ... (ignored).
158-
print = function() {
158+
print = function(...) {
159159
cat_cli(cli_h1("{.cls {class(self)[1]}}"))
160160
print(self$data[, setdiff(names(self$data), "uhash"), with = FALSE], digits = 2)
161161
},

R/AutoFSelector.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,11 @@ AutoFSelector = R6Class(
243243
}
244244
},
245245

246+
#' @description
246247
#' Printer.
248+
#'
247249
#' @param ... (ignored).
248-
print = function() {
250+
print = function(...) {
249251
msg_h = if (is.null(self$label) || is.na(self$label)) "" else paste0(": ", self$label)
250252
model = if (is.null(self$model)) "-" else class(self$model)[1L]
251253

R/EnsembleFSResult.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,9 @@ EnsembleFSResult = R6Class(
671671
)
672672

673673
#' @export
674-
as.data.table.EnsembleFSResult = function(x, ...) {
675-
x$result
674+
as.data.table.EnsembleFSResult = function(x, ..., benchmark_result = TRUE) {
675+
assert_flag(benchmark_result)
676+
if (benchmark_result) x$result else copy(get_private(x)$.result)
676677
}
677678

678679
#' @export

R/FSelector.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ FSelector = R6Class(
7373
#' @description
7474
#' Print method.
7575
#'
76+
#' @param ... (ignored).
77+
#'
7678
#' @return (`character()`).
77-
print = function() {
79+
print = function(...) {
7880
msg_h = if (is.na(self$label)) "" else paste0(": ", self$label)
7981
cat_cli({
8082
cli_h1("{.cls {class(self)[1L]}}{msg_h}")

R/embedded_ensemble_fselect.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#' Can only be [mlr3::ResamplingSubsampling] or [mlr3::ResamplingBootstrap].
3131
#' @param measure ([mlr3::Measure])\cr
3232
#' The measure used to score each learner on the test sets generated by `init_resampling`.
33-
#' If `NULL`, default measure is used.
3433
#' @param store_benchmark_result (`logical(1)`)\cr
3534
#' Whether to store the benchmark result in [EnsembleFSResult] or not.
3635
#'

man/ArchiveAsyncFSelect.Rd

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ArchiveAsyncFSelectFrozen.Rd

Lines changed: 17 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)