MyNixOS website logo
Description

Inference on the Generalization Error.

An 'mlr3' extension that provides various resampling-based confidence interval (CI) methods for estimating the generalization error. These CI methods are implemented as 'mlr3' measures, enabling the evaluation of individual algorithms on specific tasks as well as the comparison of different learning algorithms.

mlr3inferr mlr3inferr website

Methods for statistical inference on the generalization error.

Package website

RCMDCheck CRANstatus StackOverflow Mattermost

Installation

pak::pkg_install("mlr-org/mlr3inferr")

What is mlr3inferr?

The main purpose of the package is to allow to obtain confidence intervals for the generalization error for a number of resampling methods. Below, we evaluate a decision tree on the sonar task using a holdout resampling and obtain a confidence interval for the generalization error. This is achieved using the msr("ci.holdout") measure, to which we pass another mlr3::Measure that determines the loss function.

library(mlr3inferr)

rr = resample(tsk("sonar"), lrn("classif.rpart"), rsmp("holdout"))
# 0.05 is also the default
ci = msr("ci.holdout", "classif.acc", alpha = 0.05)
rr$aggregate(ci)
#>       classif.acc classif.acc.lower classif.acc.upper 
#>         0.7391304         0.6347628         0.8434981

It is also possible to select the default inference method for a certain Resampling method using msr("ci")

ci_default = msr("ci", "classif.acc")
rr$aggregate(ci_default)
#>       classif.acc classif.acc.lower classif.acc.upper 
#>         0.7391304         0.6347628         0.8434981

With mlr3viz, it is also possible to visualize multiple confidence intervals. Below, we compare a random forest with a decision tree and a featureless learner:

library(mlr3learners)
library(mlr3viz)

bmr = benchmark(benchmark_grid(
  tsks(c("sonar", "german_credit")),
  lrns(c("classif.rpart", "classif.ranger", "classif.featureless")),
  rsmp("subsampling")
))

autoplot(bmr, "ci", msr("ci", "classif.ce"))

Note that:

  • Some methods require pointwise loss functions, i.e. have an $obs_loss field.
  • Not for every resampling method exists an inference method.
  • There are combinations of datasets and learners, where inference methods can fail.

Features

  • Additional Resampling Methods
  • Confidence Intervals for the Generalization Error for some resampling methods

Inference Methods

KeyLabelResamplingsOnly Pointwise Loss
ci.con_zConservative-Z CIPairedSubsamplingfalse
ci.cor_tCorrected-T CISubsamplingfalse
ci.holdoutHoldout CIHoldoutyes
ci.ncvNested CV CINestedCVyes
ci.wald_cvNaive CV CICV, LOOyes

Citing mlr3

If we use mlr3inferr, please cite our paper:

@misc{kuempelfischer2024ciforge,
      title={Constructing Confidence Intervals for 'the' Generalization Error -- a Comprehensive Benchmark Study},
      author={Hannah Schulz-Kümpel and Sebastian Fischer and Thomas Nagler and Anne-Laure Boulesteix and Bernd Bischl and Roman Hornung},
      year={2024},
      eprint={2409.18836},
      archivePrefix={arXiv},
      primaryClass={stat.ML},
      url={https://arxiv.org/abs/2409.18836},
}

Bugs, Questions, Feedback

mlr3inferr is a free and open source software project that encourages participation and feedback. If you have any issues, questions, suggestions or feedback, please do not hesitate to open an “issue” about it on the GitHub page!

In case of problems / bugs, it is often helpful if you provide a “minimum working example” that showcases the behaviour (but don’t worry about this if the bug is obvious).

Please understand that the resources of the project are limited: response may sometimes be delayed by a few days, and some feature suggestions may be rejected if they are deemed too tangential to the vision behind the project.

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows