Questions tagged [mlr3]

mlr3 is the next generation of the mlr package for machine learning in R.

mlr3 is a redesigned version of the mlr package for machine learning in R, embracing R6 and data.table for cleaner code and more efficient operations. It provides a common interface to many learners that are implemented in R and many additional things, such as hyperparameter tuning and machine learning pipelines, on top. More information at https://mlr3.mlr-org.com/

mlr3 is a collection of packages with minimal dependencies between them to make installation easier. The mlr3 ecosystem comprises

  • the core package mlr3 and mlr3misc for miscellaneous additional functionality
  • mlr3featsel for feature selection
  • mlr3pipelines for machine learning pipelines
  • mlr3tuning for hyperparameter tuning
  • mlr3learners and mlr3extralearners for additional learner interfaces
  • mlr3ordinal for ordinal regression
  • mlr3survival for survival analysis
  • mlr3cluster for cluster analysis
  • mlr3forecasting for forecasting
  • mlr3fda for functional data analysis
  • mlr3spatiotemporal for spatial and temporal analytics
  • mlr3keras for deep learning with Keras
  • mlr3viz for visualizations
258 questions
0
votes
0 answers

Why "surv.svm" shows error in "mlr3proba" package of R?

I am using mlr3proba package of R for machine learning survival analysis. My dataset contains factor, numeric and integer features. To implement SVM I wrote the code below: task <- TaskSurv$new(id = "id", backend = dataset, time = time, event =…
Tuner
  • 56
  • 6
0
votes
0 answers

How to interpret output of "autoplot" on a regression task in mlr3 (R)?

Check section 2.2.2 of the mlr3 book: https://mlr3book.mlr-org.com/tasks.html Can someone please explain how to interpret the output charts of the line: # pairs plot (requires package GGally) autoplot(task, type = "pairs") Specifically, what's the…
0
votes
1 answer

How can I check the alignment of row_id and order variable in a task?

I generated a task and assigned an order variable ("Date"). So, I have access to the following elements: task$row_ids and task$col_roles$order. The latter helps me to double-check the name of the ordering variable, so I can retrieve the order…
ds_col
  • 129
  • 10
0
votes
2 answers

The results of a benchmark comparison for learners depends on the instantiation of the resampling. How can I account for this?

I run the code below. If I deactivate instantiation (as shown), the results of my benchmark comparison will be different for the three benchmark experiments and the conclusion which learner performs better may be different. How can I adress this…
ds_col
  • 129
  • 10
0
votes
0 answers

Generate a list of graph learners that differ by one parameter only

I want to setup a benchmark design with graph learners. From the book, I learned that with predefined learners I can do something like this: learners = c("classif.featureless", "classif.rpart", "classif.ranger", "classif.kknn") learners =…
ds_col
  • 129
  • 10
0
votes
1 answer

Aggregating performance measures in mlr3 ResampleResult when some iterations have NaN values

I would like to calculate an aggregated performance measure (precision) for all iterations of a leave-one-out resampling. For a single iteration, the result for thie measure can only be 0, 1 (if positive class is predicted) or NaN (if negative class…
ds_col
  • 129
  • 10
0
votes
0 answers

In MLR3 Ranger setting class.weights, error "Assertion on 'xs' failed: class.weights: Must have length 1"

I would like to set the class.weights parameter using a Ranger classifier in MLR3. In the base Ranger package, the class.weights parameter takes a vector. When trying to set the same parameter in MLR3, I get an error. # create a dummy dataset and…
zmek
  • 53
  • 7
0
votes
0 answers

How do you predict to new data using the best configuration found using hyperband tuning and mlr3?

I am using the mlr3 family of packages and hyperband methods to tune machine learning models. All is going well, but I am unable to figure out how to predict the best configuration found using hyperband to new data. Is it possible to do this…
0
votes
1 answer

mlr3 optimized average of ensemble

I try to optimize the averaged prediction of two logistic regressions in a classification task using a superlearner. My measure of interest is classif.auc The mlr3 help file tells me (?mlr_learners_avg) Predictions are averaged using weights (in…
ava
  • 840
  • 5
  • 19
0
votes
0 answers

Is there a constrained version of the knn algorithm that allows to specify the maximum distance?

I work with the knn algorithm in R. The alogrithm selects the k "closest" points in feature space and calculates predictions/probabilities based on these k closest points. My problem/question is: Can I specify a maximum distance? For some points the…
ds_col
  • 129
  • 10
0
votes
1 answer

Is there a way to directly assign roles to a columns of a task when importing data?

I like to import a data frame as a "task". Some of the columns are dates (of data type "yearmon") and I like to import them with the role "name" or "order". Unfortunately, it seems I have to first import the whole matrix and can only change roles…
ds_col
  • 129
  • 10
0
votes
0 answers

Using Akaike information criterion (AIC) and Bayesian information criterion (BIC) for filtering PCA factors in mlr3?

I would like to use a PCA with subsequent feature selection/filtering in mlr3. I could not yet find AIC and BIC for this "filtering" in the package/framework. Is this because they do not fit conceptually, e.g. are all methods in mlr3filters…
ds_col
  • 129
  • 10
0
votes
1 answer

Two-level stacked learner (enseble model) combining elastic net and logistic regression using mlr3

I try to solve a common problem in medicine: the combination of a prediction model with other sources, eg, an expert opinion [sometimes heavily emphysised in medicine], called superdoc predictor in this post. This could be solved by stack a model…
ava
  • 840
  • 5
  • 19
0
votes
1 answer

How to speed up resampling process with parallelizaiton in mlr3?

I try to run the resampling process with parallelization in mlr3. But I find that it always slower than the sequential plan. Here is my code and result: # load the packages library(mlr3) library(future) library(future.apply) library(tictoc) #…
Kim.L
  • 121
  • 10
0
votes
1 answer

CV or train/predict in mlr3

In a post "The "Cross-Validation - Train/Predict" misunderstanding" by Patrick Schratz https://mlr-org.com/docs/cv-vs-predict/ mentioned that: (a) CV is done to get an estimate of a model’s performance. (b) Train/predict is done to create the final…
khan1
  • 1
  • 3