Skip to content

Commit eab32d3

Browse files
jakob-rvrodriguezf
authored andcommitted
- Fix order of learners in generateLearningCurveData() (mlr-org#2768)
1 parent ab01bec commit eab32d3

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Fix learner note for learner glmnet (the default of param `s` did not match the learner note) (#2747)
99
- Remove dep {hrbrthemes} used in `createSpatialResamplingPlots()`. The package caused issues on R-devel. In addition users should set custom themes by themselves.
1010
- Explicitly return value in `getNestedTuneResultsOptPathDf()` (#2754)
11+
- Fix wrong order of learners in `generateLearningCurveData()` (#2767)
1112

1213

1314
# mlr 2.17.1.9000

R/generateLearningCurve.R

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,26 +57,22 @@ generateLearningCurveData = function(learners, task, resampling = NULL,
5757
}
5858

5959
# create downsampled versions for all learners
60-
lrnds1 = lapply(learners, function(lrn) {
60+
dsws = lapply(learners, function(lrn) {
6161
lapply(seq_along(percs), function(p.id) {
6262
perc = percs[p.id]
6363
dsw = makeDownsampleWrapper(learner = lrn, dw.perc = perc, dw.stratify = stratify)
64-
list(
65-
lrn.id = lrn$id,
66-
lrn = setLearnerId(dsw, stri_paste(lrn$id, ".", p.id)),
67-
perc = perc
68-
)
64+
setLearnerId(dsw, stri_paste(lrn$id, ".", p.id))
6965
})
7066
})
71-
lrnds2 = unlist(lrnds1, recursive = FALSE)
72-
dsws = extractSubList(lrnds2, "lrn", simplify = FALSE)
67+
dsws = unlist(dsws, recursive = FALSE)
7368

7469
bench.res = benchmark(dsws, task, resampling, measures, show.info = show.info)
70+
7571
perfs = getBMRAggrPerformances(bench.res, as.df = TRUE)
7672

7773
# get perc and learner col data
78-
perc = extractSubList(lrnds2[as.factor(perfs$learner.id)], "perc")
79-
learner = extractSubList(lrnds2[as.factor(perfs$learner.id)], "lrn.id")
74+
perc = extractSubList(bench.res$learners, c("par.vals", "dw.perc")) # get downsample reate
75+
learner = extractSubList(bench.res$learners, c("next.learner", "id")) #get ID of unwrapped learner
8076
perfs = dropNamed(perfs, c("task.id", "learner.id"))
8177

8278
# set short measures names and resort cols

0 commit comments

Comments
 (0)