Skip to content
Back to skills

Mlr3

ASecurity

R mlr3 package for machine learning. Use for modern ML framework with pipelines, tuning, and benchmarking.

  • 5 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill mlr3 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mlr3?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mlr3
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-mlr3/badge)](https://www.skillsdirectory.com/skills/leolin990405-mlr3)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mlr3
description: R mlr3 package for machine learning. Use for modern ML framework with pipelines, tuning, and benchmarking.
---

# mlr3 Package

Modern machine learning framework.

## Basic Workflow

```r
library(mlr3)
library(mlr3learners)

# Task
task <- as_task_classif(iris, target = "Species")
task <- as_task_regr(mtcars, target = "mpg")

# Learner
learner <- lrn("classif.rpart")
learner <- lrn("regr.ranger")

# Train
learner$train(task)

# Predict
prediction <- learner$predict(task)
prediction$confusion
prediction$score(msr("classif.acc"))
```

## Resampling

```r
# Cross-validation
resampling <- rsmp("cv", folds = 5)
rr <- resample(task, learner, resampling)
rr$aggregate(msr("classif.acc"))

# Holdout
resampling <- rsmp("holdout", ratio = 0.8)
```

## Hyperparameter Tuning

```r
library(mlr3tuning)

# Search space
search_space <- ps(
  cp = p_dbl(lower = 0.001, upper = 0.1),
  minsplit = p_int(lower = 1, upper = 20)
)

# Tuner
instance <- tune(
  tuner = tnr("grid_search"),
  task = task,
  learner = lrn("classif.rpart"),
  resampling = rsmp("cv", folds = 3),
  measure = msr("classif.acc"),
  search_space = search_space
)

instance$result
```

## Pipelines

```r
library(mlr3pipelines)

# Preprocessing + learner
graph <- po("scale") %>>%
  po("encode") %>>%
  lrn("classif.ranger")

graph_learner <- as_learner(graph)
graph_learner$train(task)
```

## Benchmarking

```r
design <- benchmark_grid(
  tasks = list(task1, task2),
  learners = list(lrn("classif.rpart"), lrn("classif.ranger")),
  resamplings = rsmp("cv", folds = 5)
)

bmr <- benchmark(design)
bmr$aggregate(msr("classif.acc"))
```

## Available Learners

```r
mlr_learners  # List all
as.data.table(mlr_learners)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.