mlr-org / mlr3

mlr3: Machine Learning in R - next generation
https://mlr3.mlr-org.com
GNU Lesser General Public License v3.0
927 stars 86 forks source link

fix: change predict_type for generic measures #889

Closed mllg closed 1 year ago

mllg commented 1 year ago

Addressing #816

Change predict_type of generic measures to NA to avoid an unnecessary check which renders extensions difficult.

Also renamed MeasureDebug to be more specific.

mllg commented 1 year ago

@RaphaelS1 does this solve #816 ?

RaphaelS1 commented 1 year ago

Looks like it should. Happy for @sebffischer to test and decide if it makes sense (saw his ideas in the other issues) and approve if so

sebffischer commented 1 year ago

So @mllg s solution is much simpler than my suggestion. It also solves the bug from the other issue:

library(mlr3proba)
#> Loading required package: mlr3
library(mlr3extralearners)

l = lrn("surv.ranger")
t = tsk("rats")
l$train(t)
p = l$predict(t)
m = msr("oob_error")

p$score(m, learner = l)
#> oob_error 
#> 0.2516677
l$oob_error()
#> [1] 0.2516677

m$predict_type
#> [1] NA
p$predict_types
#> [1] "crank" "distr"

Created on 2023-01-24 by the reprex package (v2.0.1)