mlr3inferr

Statistical methods for inference on the generalization error

https://github.com/mlr-org/mlr3inferr

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary

Keywords

machine-learning r statistics
Last synced: 10 months ago · JSON representation

Repository

Statistical methods for inference on the generalization error

Basic Info
Statistics
  • Stars: 4
  • Watchers: 4
  • Forks: 0
  • Open Issues: 1
  • Releases: 2
Topics
machine-learning r statistics
Created about 2 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  cache = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(mlr3)
library(mlr3misc)
set.seed(1)
lgr::get_logger("mlr3")$set_threshold("warn")
```

# mlr3inferr mlr3inferr website

Methods for statistical **inf**erence on the generalization **err**or.

Package website: [release](https://mlr3inferr.mlr-org.com/) | [dev](https://mlr3inferr.mlr-org.com/dev/)


[![RCMD Check](https://github.com/mlr-org/mlr3inferr/actions/workflows/r-cmd-check.yml/badge.svg)](https://github.com/mlr-org/mlr3inferr/actions/workflows/r-cmd-check.yml)
[![CRAN status](https://www.r-pkg.org/badges/version/mlr3inferr)](https://CRAN.R-project.org/package=mlr3inferr)
[![StackOverflow](https://img.shields.io/badge/stackoverflow-mlr3-orange.svg)](https://stackoverflow.com/questions/tagged/mlr3)
[![Mattermost](https://img.shields.io/badge/chat-mattermost-orange.svg)](https://lmmisld-lmu-stats-slds.srv.mwn.de/mlr_invite/)


## Installation

```{r, eval = FALSE}
# Install release from CRAN
install.packages("mlr3inferr")
# Install development version from GitHub
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.

```{r}
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)
```

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

```{r}
ci_default = msr("ci", "classif.acc")
rr$aggregate(ci_default)
```

With [`mlr3viz`](https://mlr3viz.mlr-org.com), it is also possible to visualize multiple confidence intervals.
Below, we compare a random forest with a decision tree and a featureless learner:


```{r, dpi = 300, out.width = "70%", fig.align = "center"}
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.

:warning: **Different point estimates for the same measure**

In general, the point estimate of `$aggregate(msr("ci", ))` will **not** always be exactly identical to the point estimate of `$aggregate(msr())`.
This is because the point estimation for the former is defined by the inference method, and can, for example, as is the case for nested cross-validation, contain a bias correction term, or use a different aggregation method.
This is demonstrated in the example below.

```{r}
rr = resample(tsk("iris"), lrn("classif.rpart"), rsmp("ncv", folds = 5L, repeats = 20L))
ce = msr("classif.ce")
ci = msr("ci", ce)
c(rr$aggregate(ce)[[1]], rr$aggregate(ci)[[1]])
```

## Features

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


## Inference Methods

```{r, echo = FALSE}
content = as.data.table(mlr3::mlr_measures, objects = TRUE)[startsWith(get("key"), "ci."),]
content$resamplings = map(content$object, function(x) paste0(gsub("Resampling", "", x$resamplings), collapse = ", "))
content[["only pointwise loss"]] = map_chr(content$object, function(object) {
  if (get_private(object)$.requires_obs_loss) "yes" else "false"
})
content = content[, c("key", "label", "resamplings", "only pointwise loss")]
knitr::kable(content, format = "markdown", col.names = tools::toTitleCase(names(content)))
```

## Citing mlr3

If you 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},
    }


## Acknowledgements

This R package is developed as part of the [Mathematical Research Data Initiative](https://www.mardi4nfdi.de/about/mission).

## 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.

Owner

  • Name: mlr-org
  • Login: mlr-org
  • Kind: organization
  • Location: Munich, Germany

GitHub Events

Total
  • Create event: 3
  • Release event: 2
  • Issues event: 1
  • Watch event: 2
  • Push event: 31
  • Pull request event: 3
  • Pull request review event: 1
  • Pull request review comment event: 1
Last Year
  • Create event: 3
  • Release event: 2
  • Issues event: 1
  • Watch event: 2
  • Push event: 31
  • Pull request event: 3
  • Pull request review event: 1
  • Pull request review comment event: 1

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 47
  • Total Committers: 1
  • Avg Commits per committer: 47.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 20
  • Committers: 1
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Sebastian Fischer s****r@g****m 47

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 7
  • Total pull requests: 3
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 3 months
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.14
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 6 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • sebffischer (3)
Pull Request Authors
  • sebffischer (3)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 2,478 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: mlr3inferr

Inference on the Generalization Error

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 2,478 Last month
Rankings
Dependent packages count: 27.4%
Forks count: 29.0%
Stargazers count: 29.3%
Dependent repos count: 33.8%
Average: 41.3%
Downloads: 87.0%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/pkgdown.yml actions
  • JamesIves/github-pages-deploy-action v4.6.1 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/r-cmd-check.yml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 3.1.0 depends
  • mlr3 * depends
  • R6 * imports
  • checkmate * imports
  • data.table * imports
  • future * imports
  • lgr * imports
  • mlr3misc * imports
  • paradox * imports
  • withr * imports
  • testthat >= 3.0.0 suggests