-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mlr3 targets post #41
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: "mlr3-targets: how to use {mlr3} and {targets}" | ||
description: | | ||
The repository `mlr3targets` presents a skeleton that shows how to conduct a benchmark in {mlr3} using the workflow package {targets}. | ||
author: | ||
- name: Patrick Schratz | ||
date: 2022-05-08 | ||
categories: | ||
- R | ||
- tutorial | ||
output: | ||
distill::distill_article: | ||
self_contained: false | ||
--- | ||
|
||
|
||
```{r setup, include=FALSE} | ||
knitr::opts_chunk$set(echo = FALSE) | ||
``` | ||
|
||
The [mlr3-learndrake](https://github.com/mlr-org/mlr3-learndrake) repository has been deprecated and (finally) been ported to it's successor {targets}. | ||
|
||
The new [mlr3-targets](https://github.com/mlr-org/mlr3-targets) repository shows exemplary how {mlr3} and {targets} can be used jointly. | ||
The example implements a benchmark of two learners across two (example) tasks by making use of "dynamic branching" in {targets}. | ||
It also showcases the use of an opinionated project structure for {targets} projects and demonstrates how custom functions can be used within {targets} projects. | ||
|
||
The SVM learner in the project makes use of a custom "trafo" function to transform the hyperparameter search space. | ||
|
||
The power of {targets} gets visible once changes are applied to the project. | ||
For example, adding an additional task to the project (e.g. `sonar` via `tidyr::crossing(task = c("iris", "spam", "sonar")))` in `06-benchmark.R`) and invoking `tar_make()` again will only build the models for the newly added task and skip already existing ones. | ||
|
||
Here's the output from `tar_make()` for the described scenario. | ||
Existing branches of the `bm_*` targets are skipped (e.g. `bm_6f2e35d0`) while missing ones are built (`bm_be2cba98`) and merged into the main target `bm` at the end. | ||
|
||
```r | ||
✔ skip branch bm_8067dbd2 | ||
• start branch bm_ad7f3ff3 | ||
• built branch bm_ad7f3ff3 | ||
✔ skip branch bm_0f8f184b | ||
✔ skip branch bm_16624f9e | ||
• start branch bm_d1764c21 | ||
• built branch bm_d1764c21 | ||
✔ skip branch bm_6f2e35d0 | ||
✔ skip branch bm_335412b5 | ||
• start branch bm_5b82da98 | ||
• built branch bm_5b82da98 | ||
✔ skip branch bm_5fdc62fd | ||
✔ skip branch bm_c02dd27e | ||
• start branch bm_be2cba98 | ||
• built branch bm_be2cba98 | ||
✔ skip branch bm_da5f38fa | ||
• built pattern bm | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add one of these figures with red and green targets instead of the log. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It tried but I couldn't get them large enough to be well visible in the post. Usually one does it with zooming but this is ofc not an option here. |
||
|
||
For more examples related to {targets}, consult its excellent online documentation at https://books.ropensci.org/targets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's -> its