+
Skip to content

ResampleResult and BenchmarkResult should expose a method to change the threshold after the fact #1270

@sebffischer

Description

@sebffischer

Consider the example below.
There, I would like to have a $set_threshold() method (for BenchmarkResult, ResampleResult) to conveniently change the response predictions so to be able to re-evaluate a measure.

library(mlr3)
rr = resample(
  tsk("sonar"),
  lrn("classif.rpart", predict_type = "prob"),
  rsmp("holdout")
)
#> INFO  [14:08:30.452] [mlr3] Applying learner 'classif.rpart' on task 'sonar' (iter 1/1)

rr$prediction(1)
#> <PredictionClassif> for 69 observations:
#>  row_ids truth response     prob.M    prob.R
#>        2     R        M 1.00000000 0.0000000
#>        4     R        R 0.05714286 0.9428571
#>        5     R        M 1.00000000 0.0000000
#>      ---   ---      ---        ---       ---
#>      203     M        M 1.00000000 0.0000000
#>      206     M        M 1.00000000 0.0000000
#>      207     M        M 1.00000000 0.0000000

Created on 2025-04-03 with reprex v2.1.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载