Skip to content

Commit c629e6b

Browse files
committed
pass measure in performance filter + test
1 parent e9e21d2 commit c629e6b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

R/FilterPerformance.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ FilterPerformance = R6Class("FilterPerformance",
7979

8080
perf = map_dbl(fn, function(x) {
8181
task$col_roles$feature = x
82-
resample(task, self$learner, self$resampling, clone = character())$aggregate()
82+
resample(task, self$learner, self$resampling, clone = character())$
83+
aggregate(measures = self$measure)
8384
})
8485

8586
if (self$measure$minimize) {

tests/testthat/test_FilterPerformance.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ test_that("FilterPerformance", {
44
resampling = rsmp("holdout")
55
f = flt("performance", learner = learner, resampling = resampling)
66

7+
expect_equal(f$measure$id, "classif.ce")
78
f$calculate(task)
89
expect_filter(f, task = task)
9-
expect_true(all(f$scores <= 0))
10+
expect_true(all(f$scores <= 0)) # default measure is classif.error
11+
12+
f = flt("performance", learner = learner, resampling = resampling,
13+
measure = msr("classif.acc")) # change measure
14+
expect_equal(f$measure$id, "classif.acc")
15+
f$calculate(task)
16+
expect_filter(f, task = task)
17+
expect_true(all(f$scores >= 0))
1018
})

0 commit comments

Comments
 (0)