Questions tagged [mlr3]
mlr3 is the next generation of the mlr package for machine learning in R.
195
questions
1
vote
1
answer
20
views
How to set the graph learner id in mlr3pipelines?
I construct a benchmark with 4 graph learners on 1 dataset. The learner_id of the result of the benchmark is so long because I have some preprocessings. How can I set the learner id so that it wouldn'...
1
vote
1
answer
53
views
How to set "budget" tag for xgboost hyperband optimization with mlr3tuningspaces?
I am trying to tune xgboost with hyperband and I would like to use the suggested default tuning space from the mlr3tuningspaces package. However, I don't find how to tag a hyperparameter with "...
0
votes
1
answer
38
views
How to define the classification threshold as a (hyper)parameter of a learner for tuning in mlr3 package in R?
there is a function to tune threshold for say a binary classification described here: https://mlr3pipelines.mlr-org.com/reference/mlr_pipeops_tunethreshold.html
Here's my failed attempt:
RF_lrn <-...
0
votes
1
answer
59
views
survxai explainer with an mlr3proba model
I am trying to build a survxai explainer from a survival model built with mlr3proba. I'm having trouble creating the predict_function necessary for the explainer. Has anyone ever tried to build ...
0
votes
1
answer
36
views
How to apply pipeline_smote just on training set in mlr3pipelines?
I am working on an imbalanced dataset with a two-class response variable using mlr3. I want to apply SMOTE method to oversample the minority. I learned that this method should be used only on the ...
0
votes
1
answer
20
views
Error: message "with parameters optimization using mlr3"
I am using parameters optimization (random search) with mlr3 but it gives me the following error. I tried with other models too (kknn) but the same error comes in.
Error: Resampling 'cv' may not be ...
0
votes
0
answers
11
views
Expand_range argument in mlr3 for visualization of qda
so I am trying to vizualize the prediction of an QDA-learner using the mlr3viz-package in R. The vizualisation (via plot_learner_prediction) works fine, however everytime I try to expand the range of ...
0
votes
0
answers
31
views
explaining clasification models in mlr3 with DALEX
I like to use the DALEX package in mlr3 and I tried to work with an example similar to chapter 9.2.4 in the mlr3 book (https://mlr3book.mlr-org.com/interpretation.html).
So my code looks like this
# ...
1
vote
0
answers
43
views
mlr3: extract variable importance for each resampling iteration
I would like to extract variable importance for each resampling iteration with mlr3. So far, I have only found a "manual" way of doing it so I was wondering if there was a wrapper function ...
-2
votes
1
answer
85
views
Extra learners in mlr3 [closed]
I cannot use models in mlr3 other than random forest, part, knn, svm, gbm etc. I am using mlr3extralearners package but still it seems there are a lot of models supported. How to use nnet, mlp etc in ...
1
vote
0
answers
62
views
feature importance in mlr3 with iml for classification forests
I calculate feature importance for 2 different types of machine learning models (SVM and Classification Forest). I cannot post the data here, but I describe what I do:
My (classification) task has ...
0
votes
0
answers
29
views
Storing and working with multi-output Tasks in mlr3
I have a multitarget regression problem and would like to include such a task/ learner in my mlr3 pipeline.
The only information I could find on this topic in the mlr3 information was this on GitHub: ...
0
votes
0
answers
25
views
Benchmark Analysis When results have a few NaN
I am unable to carry out benchmark analysis because my results has a few NaN. I tried na.rm = TRUE, but that did not help remove the NaN. Is there a way to conduct the analysis presented in https://...
0
votes
1
answer
42
views
Adding a new learner to the mlr3 environment (grpreg)
How might I use the grpreg package with mlr3 (esp with the resamplings etc)? I did a search and came across the create_learner function but found the arguments confusing (I don't know what are the ...
1
vote
1
answer
35
views
I need good model serialization. Default R serialization is nighter safe nor effective from the point of model size
MLR3 model includes a lot of redundant data not needed when applying the model. The traditional R approach is to save all the data used for model training. It leads to the growth of used memory. What ...
1
vote
1
answer
87
views
mlr3 survival distribution estimation at specific time-points
I'm looking for a faster way to extract predicted survival distributions with mlr3 and mlr3proba.
The prediction procedure is highly time-consuming, expecially using datasets with hundreds of ...
0
votes
0
answers
21
views
Follow Up Question About Whether Preprocessing Test Set Is Needed
Please refer to the previous question here (https://stackoverflow.com/a/71389007/17537724)
With the pipeline below, will imputation, scaling and dummying variables be performed automatically on test ...
0
votes
0
answers
28
views
Is It Possible to Find an Optimal Cut Point that Maximizes C-index
If I am using a survival model that is not tree-base and I want to dichotomize influential continuous variables (age, weight) to simplify my final model for clinical use, is that possible to do with ...
0
votes
1
answer
55
views
Is Test Set Preprocessing really needed in mlr3?
When I include preprocessing (selection, imputation, transformation etc) steps in the modeling framework, do I need to repeat this for the test set before prediction when using the mlr3 framework. I ...
0
votes
1
answer
34
views
Default resampling method in mlr3
If I did not mention any resampling methods in my mlr3 code, what happens in the background? Does it run a default resampling method? If yes, what is it? k-fold CV ?
Warm regards
0
votes
0
answers
34
views
Problem with Tuning & Benchmark "surv.svm"
I get different error messages when I try to tune/benchmark "surv.svm".
For tuning I get the following error
Error in kernelMatrix(Xtrain = sv, kernel_type = kernel_type, kernel_pars = ...
0
votes
1
answer
44
views
Error in UUIDgenerate() : Too many DLL modules. in mlr3 pakcage
I using the mlr3 package for autotuning ML models (mlr3pipelines graph, to be more correct).
It is very hard to reproduce the problem because the error occurs occasionally. The same code sometimes ...
1
vote
1
answer
93
views
How to perform spatial crossvalidation using mlr3 and then perform raster predict
I have the following problem. I want to build a model for landcover classification. My data are multitemporal Remote Sensing data with several bands. For training I created stratified randomly ...
1
vote
0
answers
47
views
How to combine autofselector and autotuner models in a Benchmark
How I can make a list of learners including autofselector and autotuner in benchmark and compare their performance?
I wonder how to rank learners stratified by task when we have multiple tasks
library(...
2
votes
1
answer
72
views
How to add a gradient function when using nloptr in the mlr3 tuning process
i try to use bfgs as a solver for the optimization problem in the mlr3 tuning step.
I checked the documentation for how to add the gradient that the solver needs.
Although i am able to add it in the ...
0
votes
1
answer
30
views
how to Save BMR results and read them again for analysis and plotting
I wonder if it is possible to save BMR in an external file and read it later on for analysis and plotting.
Also, when multiple performance measures are used, can learners be ranked based on the ...
1
vote
1
answer
56
views
How to tune a vector of two values in mlr3
The survival SVM model using hybrid approach requires gamma.mu to be a vector as below. How can we tune gamma.mu in this case?
lrn("surv.svm", type = "hybrid", diff.meth = "...
0
votes
1
answer
21
views
How to construct the FSelectInstanceSingleCrit in mlr3FSelect?
I copied the code from mlr3book:
library(mlr3verse)
task = tsk("pima")
print(task)
learner = lrn("classif.rpart")
hout = rsmp("holdout")
measure = msr("classif.ce&...
1
vote
1
answer
67
views
How to predict new datasets after the `tune_nested`?
# retrieve task
task = tsk("pima")
# load learner and set search space
learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE))
# nested resampling
rr = ...
0
votes
1
answer
41
views
how to use tune_nested() of mlr3tuning?
rm(list = ls())
library(mlr3verse)
task <- tsk("pima")
learner <- lrn("classif.rpart")
measure <- msr("classif.ce")
inner_resample <- rsmp("cv", ...
0
votes
1
answer
63
views
Number of configurations in mlr3 hyperband tuning
How can I control the number of configurations being evaluated during hyperband tuning in mlr3? I noticed that when I tune 6 parameters in xgboost(), the code evaluates about 9 configurations. When I ...
0
votes
1
answer
98
views
MLR3 Basics for Categorical Variables
I'm (extremely) new to using MLR3, and am using it to model flight delays. I have some numerical variables, like Z, and some categorical variables like X. Let's just say I want to do a very simple ...
0
votes
1
answer
33
views
mlr3 hyperband: unused argument (clone = character())
I want to code some hyperband tuning in mlr3. I started with running the subsample-rpart hyperband example from chapter 4.4 in mlr3 book - directly copied from there. I am getting an error:
Error in ...
0
votes
0
answers
33
views
Can DALEX be used for mlr3 surv models?
I am not sure if I can use DALEX for assess my mlr3 survival models because y argument does not accept Surv(time, status). I also don't think results are correct when I "status" for y since ...
1
vote
1
answer
68
views
mlr3 AutoFSelector glmnet: Error in (if(cv)glmnet::cv.glmnet else glmnet::glmnet)(x = data, y = target, :# x should be a matrix with 2 or more columns
I am a beginner on mlr3 and am facing problems while running AutoFSelector learner associated to glmnet on a classification task containing >2000 numeric variables.
I reproduce this error while ...
0
votes
0
answers
68
views
mlr3 tuning: Error cannot allocate vector of size n Mb
I always hit the memory limit when I try to tune a model with mlr3 and I get the follow error (Error cannot allocate vector of size n Mb). This happens even when I remove all unneeded objects and try ...
0
votes
1
answer
88
views
mlr3 Tune on Multiple Measures & Distrcompositor
I get an error when I try to auto-tune on cindex and IBS. I can only use one performance measure. This is also the case for auto-selector that accepts only one performance measure.
I also have a ...
0
votes
0
answers
49
views
What is the difference between budgeted and non-budgeted parameters for the Hyperband algorithm?
I struggle to understand how the Hyperband algorithm should be set up.
In the book (https://mlr3book.mlr-org.com/optimization.html#hyperband), I find e.g. the following sample code:
set.seed(123)
# ...
1
vote
0
answers
252
views
Difference in Computation Speed and Results Between MLR and MLR3
I don't get similar results when I use the same data and models using mlr and mlr3. Also I find mlr runs at least 20-fold faster. I used lung data from survival and I was able to replicate the ...
0
votes
0
answers
53
views
How to Get Optimal Models From Benchmark For Prediction on Test Data
This question is applicable to both mlr and mlr3 but I only included the code for mlr since I have it handy.
As an example, when we have 3 folds outer CV, we get 3 sets of optimal hyperparameters (...
0
votes
1
answer
244
views
Bayesian optimization for hyperparameter tuning using mlr3
Are there any hyperparameter tuners using Bayesian optimization within the mlr3 ecosystem?
In particular as an argument in the wrapper function
tuner = tnr("grid_search", resolution = 10)
?
...
0
votes
0
answers
34
views
Can I manually export objects and libraries to future multisession workers in mlr3
mlr3 has a neat parallel start button via future::plan().
However, when I want to customize pipeline operators which involve external objects and libraries, the workers will end with object not found ...
1
vote
1
answer
83
views
How to impute for resampling rather than embedding imputation pipeline with a learner, especially for nested cross validation?
I want to first do imputation within each cv fold and then train the learner with autotuner, and test it on testing sets.
I can see that once the resampling scheme is fixed, the imputation is fixed, ...
0
votes
1
answer
27
views
mlr3 simple question. How do I set fixed hyperparameter values
Hopefully a simple question but incredibly annoying lack of information in the mlr3 book! So I have a tuned learner (regr.bart) that I want to simply set one hyperparameter to a fixed (not tuned) ...
0
votes
0
answers
94
views
How to run parallel in breakdown algorithm?
I have some lines code following.
library(mlr3)
library(mlr3pipelines)
library(mlr3extralearners)
library(DALEX)
library(DALEXtra)
library(tidyverse)
data = tsk("german_credit")$data()
data ...
0
votes
2
answers
111
views
How can I use a pipeline graph with upsampling when my task is ordered?
I have a task where the observation in rows have a date order. I generate a custom resampling scheme that respects this order in all train/test splits.
I also want to adress the unbalanced classes ...
1
vote
1
answer
211
views
MLR3 Survival Analysis: how to simultaneously perform feature selection & hyperparameter tuning together and get selected_features?
I am trying to fit coxph and parametric models and simultaneously perform feature selection and hyperparameter tuning. I have the following code below where I can use either auto_fselecter or ...
0
votes
0
answers
69
views
How to Impute missing values by bag and KNN in MLR3
I want to impute missing values by bag and KNN. how do I do that with MLR3 correctly?
Looking at some examples, it seems possible using mlr3pipelines but not 100% sure
po("imputelearner", ...
0
votes
1
answer
118
views
How to use task$select to select features to be removed instead of to be kept
I have a dataset with many features and I am trying to remove unwanted features at the task step using task$select(c("A"...)
Instead of listing the features I want to keep (a lot), I want to ...
0
votes
1
answer
58
views
How do I save my model to use in another project in mlr3?
I would like to divide my working pipeline in 2:
One place (internal) where to benchmark and auto-tune the alrithms to select the final model.
Apply the selected models to new datasets (external).
...