# Questions tagged [mlr]

mlr is a machine learning package for R that provides an interface to many other packages.

**0**

votes

**0**answers

21 views

### Error: == irace == 'digits' (--digits) must be within [1,15] within MLR package

I'm trying to run this code found in the MLR tutorial, I get the following error:
Error: == irace == 'digits' (--digits) must be within [1,15].
I already tried the function convertParamSetToIrace ...

**2**

votes

**1**answer

32 views

### R: Predicting with new factor levels in mlr with regr.svm task

I am using the mlr package to predict from an SVM. If my validation set contains factor levels not present in my training data, the prediction fails, regardless of how I set fix.factors.prediction ...

**2**

votes

**1**answer

32 views

### Tuning without resampling in mlr package (clustering)

In the mlr package, I can perform a clustering. Let´s say I don´t want to know how the model performs on unseen data, but I just want to know what the best number of clusters are regarding a given ...

**0**

votes

**0**answers

28 views

### Custom Weighted Resampling

How can I create a custom weighted ResampleInstance in mlr? It is possible to specify weights in the train function or in a task description. I need to create custom weights for a time series for ...

**1**

vote

**1**answer

27 views

### MLR resampling creates oneclass problems for multilabel classification

I am trying to measure performance of multilabel classification for some MLR classifiers using cross validation
I tried to use MLR resample method or pass my own subset, however in both situations an ...

**0**

votes

**1**answer

14 views

### Read multiple rds models and use predict function in lapply?

I have bunch of models saved as .rds, after reading all models and I use the predict function in loop on test data, showing error on predict method, but using individual model is working. (model are ...

**0**

votes

**0**answers

33 views

### Problem to edit a function loaded from a namespace

I would like to temporarily modify selectFeatures function from mlr package. But something goes wrong when I try to do this (with assignInNamespace function) since selectFeatures is never modified as ...

**3**

votes

**1**answer

73 views

### mlr package: Cross-validation with tuneParams() and resample() yield different results

I try using tuneParams() and resample(), both of which are from mlr package, to double check my cross-validation RMSE.
However, I could not get the 2 functions to yield the same result.
Tune ...

**0**

votes

**1**answer

45 views

### Choosing initial population of mlr genetic algorithm

I would like to choose the initial population of the genetic algorithm for variable selection with makeFeatSelControlGA() function from mlr package.
Is it doable ?
Edit
Since it is not implemented ...

**0**

votes

**1**answer

40 views

### How to Deploy model using plumber API from CMD line R?

New to using plumber API, trying to deploy R model, I have saved the R Model and a test data (OneRecord). Ran the plumber API from CMD line, 127.0.0.1:8000 returns Error "{"error":["500 - Internal ...

**0**

votes

**0**answers

17 views

### makeClassif with MLR - ID column excluded from task

I have data that has an ID column in it. I drop this column from my trainTask as it is not a feature. However, I would like to link the prediction probability up with the actual ID number in the data.
...

**2**

votes

**1**answer

29 views

### Blocking in cross validation in mlr with subject id

I have a dataset with multiple observations by participant. Participants are denoted by id. To account for this in the cross validation process, I add blocking = factor(id) to makeClassifTask() and ...

**1**

vote

**1**answer

53 views

### R: How to use parallelMap (with mlr, xgboost) on linux server? Unexpected performance compared to windows

I am trying to parallelize at the tuning hyperparameter level an xgboost model that I am tuning in mlr and am trying to parallelize with parallelMap. I have code that works successfully on my ...

**0**

votes

**1**answer

44 views

### Tuning h2o Hyperparameters in mlr?

Q1: How to tune the "hidden" hyperparameter in "classif.h2o.deeplearning"?
I am getting different approaches from stackOverFlow
makeDiscreteParam("hidden", values = list(one = 10, two = c(10, 5, 10)...

**0**

votes

**1**answer

46 views

### How to set a fixed random seed for the inner loop of nested hyper-parameter tuning?

I'm trying to do hyper-parameter tuning with nested crossvalidation. This is my inner loops for two learners lrn1 and lrn2:
inner = makeResampleDesc("CV", iters = 3L)
tune_lrn1 <- makeTuneWrapper(...

**1**

vote

**1**answer

48 views

### Partial dependence must be requested with partial.dep when tuning more than 2 hyperparameters?

I am tuning more than 2 hyperparameters, while Generate hyperparameter effect data using the function generateHyperParsEffectData I set partial.dep = TRUE, while plotting plotHyperParsEffect i am ...

**0**

votes

**1**answer

32 views

### Installing mlr package in AzureML Experiment

I am trying to install mlr package in AzureML Experiment, but getting Error, I have the windows binary zip file for the mlr package and its dependencies like ParamHelpers, and connected the zip in a ...

**2**

votes

**1**answer

54 views

### How to make the benchmark function not to fail if a specific learner fails on a specific task?

I need to compare various learners on multiple tasks (> 100 000 hourly temperature records from weather stations) in a benchmark experiment.
Because one of my learners may sometimes fails (and it is ...

**1**

vote

**0**answers

37 views

### MLR: How to extract feature Selection inside a benchmark

I want to do a benchmark with different models in mlr via 3 fold cross validation. In every fold i want to do again via a 3 fold cross validation a feature selection for every model and pass the best ...

**1**

vote

**1**answer

110 views

### What does the warning “NA used as a default value for learner parameter missing” mean in mlr?

I am running a classification xgboost via the mlr package. I have missing values in my data, which I would like to preserve (that is, I would like to keep these observations and I would like to avoid ...

**0**

votes

**0**answers

28 views

### How to fix possible dummies problem using MLR as well as R error for undefined columns selected

I am working on an assignment, and I have trouble understanding the R documentation and usage in regards to specific data sets. My teacher wants us to use the book example code as the basis, which i'm ...

**0**

votes

**1**answer

18 views

### How to use blocking.cv

When i try to run the following code
rdesc <- makeResampleDesc("CV", blocking.cv = TRUE,iters=5L,folds=10)
i take this error
Error in makeResampleDescCV(blocking.cv = TRUE, iters = 5L, folds = ...

**0**

votes

**0**answers

54 views

### How to use mlr package wrapped model as it is?

Model
rf.lrn.base = makeLearner("classif.randomForest", predict.type = "prob",fix.factors.prediction=TRUE)
rf.lrn <- makeFilterWrapper(rf.lrn.base,fw.method = "chi.squared", fw.perc = 0.5)
rf.lrn
...

**0**

votes

**1**answer

47 views

### How to write a predict function for mlr predict to upload in AzureML as webservice?

I am trying to upload a R Model in AzureML as webservice, model uses mlr package in R and its predict function, the output of mlr predict is a table of "PredictionClassif" "Prediction", for the linear ...

**0**

votes

**0**answers

166 views

### How to avoid getting grid arrangements with plotROCCurves()?

I want to plot ROC Curves into one plot, so that I can compare each one. An easy on going tutorial for that can be found on MLR-org.com.
There you found this example:
library(mlr)
n = getTaskSize(...

**0**

votes

**0**answers

22 views

### Filter partial dependencies by effect size

I fitted a model and want to take a look (and plot) at the partial dependencies.
For this task, I use the mlr package. However, since I have 80 features I only want to look at those with the highest ...

**0**

votes

**0**answers

43 views

### Keep column names for createDummyFeatures “reference” (n-1)

I have this kind of data.
library(dplyr)
glimpse(samp)
Observations: 5
Variables: 5
$ review_count <int> 68, 3, 7, 9, 5
$ Alcohol <fct> full_bar, NA, ...

**0**

votes

**0**answers

45 views

### MLR: Extracting the names of the covariates with non-zero coefficients in CoxBoost

I am using mlr to create a survival model with the learner cv.CoxBoost and 5-fold cross-validation. (Yes I realise cv.CoxBosst has CV built in, but I am adding another level to be consistent with the ...

**0**

votes

**1**answer

25 views

### offset in makeRegrTask mlr package

Is it possible to have an offset in mlr makeRegrTask?
I want to use xgboost with a poisson count objective with non-unit weights and hence wish to use base_margin but unless I am missing something ...

**0**

votes

**1**answer

50 views

### where can I find a complete example of using mlr package in R

I am just studying mlr package, R. But all the tutorial that I can find focus on the usage of every single function. I hope I can find a comprehensive example including all the steps in modeling.
...

**0**

votes

**1**answer

57 views

### mlr package - Trying to integrate a new clustering learner. Default values in par.vals are being ignored (within makeRLearnerCluster method)

I am trying to integrate the MiniBatchKmeans function of package ClusterR to mlr. As per the docs, I have made the following changes:
Created makeRLearner.cluster.MiniBatchKmeans
Created trainLearner....

**1**

vote

**0**answers

39 views

### Choosing prediction model with regularization, spatial cross-validation and bounded predictions

I am new to machine learning and R. I want to run a statistical model to predict daily hours of supply of electricity (y). I have several x variables to use for prediction. I have three goals to ...

**1**

vote

**0**answers

18 views

### Correct usage of mlr::mergeBenchmarkResults

I'm trying to resolve an error I'm facing with mlr::mergeBenchmarkResults, which is:
Error in mergeBenchmarkResults(bmrs = list(bmr, bmr_no_mos)): The following task - learner combination(s) occur ...

**1**

vote

**1**answer

37 views

### MLR package R - Change formula for GLM

I am new to the mlr package. I am trying to change formula for my glm that I am fitting using the mlr package.
I am fitting my logistic regression using the below code.
#logistic regression
...

**0**

votes

**1**answer

50 views

### In nested resampling, classification accuracy results change wildly

Using mlr package in R, I am creating random forest models. To evaluate classification accuracy of the model I am using nested resampling as described in here. My problem is that classification ...

**1**

vote

**1**answer

446 views

### How to visualize and print rules of the classif.rpart model from mlr package, like in rpart.plot and rpart.rules?

I'm creating rules from the decision tree generated by mlr package wrapper learner classif.rpart, how to print the rules as in rpart.rules and how to visualize as in rpart.plot
Created the learner ...

**0**

votes

**1**answer

118 views

### Tuning the classification threshold in mlr

I am training a Naive Bayes model using the mlr package.
I would like to tune the threshold (and only the threshold) for the classification. The tutorial provides an example for doing this while ...

**0**

votes

**1**answer

21 views

### mlr: creating plotBMRBoxplots for only one of the learner

does anyone know whether it is possible to create the plots integrated in the mlr package for only one of the learners?
For example:
BMR_Boxplot <- plotBMRBoxplots(bmr, measure = mse)
...

**0**

votes

**0**answers

19 views

### Multi criteria tuning as inner resampling loop

Am I correct in stating that mlr currently does not support multi criteria tuning as inner resampling loop in a nested resampling strategy?
I currently run the inner & outer resampling loops ...

**0**

votes

**1**answer

27 views

### Progress bar on mlr::impute()

I would like to process bigger datasets in a generic fashion using MLR, specifically using the impute and the reimpute functions.
Since the data it has to fill and the size of the dataset, I would ...

**0**

votes

**0**answers

17 views

### Information gain in mlr package on a large matrix

I have a matrix with 200 rows and 190.000 columns.
Even when lunching R with the maximum value accepted of 500000 (--max-ppsize= 500000) on linux. I got error: unable to allocate a vector of size 133 ...

**2**

votes

**0**answers

82 views

### MLR not registering learner in RStudio job

I have an mlr pipeline that requires a custom learner I built. I defined all the required functions and after running them, I can use the learner. However, when I run the script as a separate job in ...

**1**

vote

**0**answers

78 views

### MLR - Survival analysis with time-dependent data

I am using mlr and would like to be able to use the extended version of the Cox PH model for right-censored, time dependent covariates. This is what I have tried, following the vignette on time-...

**0**

votes

**0**answers

36 views

### How to use weights in custom measure for mlr?

When defining a new measure using mlr::makeMeasure, in particular
mlr::makeMeasure(
fun = function(task, model, pred, feats, extra.args) { }
)
I know I can access the truth with pred$data$...

**0**

votes

**1**answer

38 views

### Feature selection in mlr using univariate.model.score filter on censored data

I am trying to perform feature selection in R using mlr and the univariate.model.score filter. In the documentation it says that surv.rpart is the default learner for this filter. My dataset contains ...

**0**

votes

**1**answer

56 views

### R mlr surv.ranger Error in `[.data.frame`(num.response, x == y) : undefined columns selected

Prepare the data ("ovarian" from survival package):
require(pacman)
p_load(mlr, survival, tidyverse, ranger)
data("ovarian")
ovarian$rx <- factor(ovarian$rx,
levels = c("1", "...

**0**

votes

**0**answers

283 views

### Getting the feature importance in a SVM

I did a multiclass (3) classification using a SVM with a linear kernel.
For this task, I used the mlr package. The SVM is from the kernlab package.
library(mlr)
library(kernlab)
print(...

**0**

votes

**1**answer

35 views

### how to get and set hyperparameter from a mlr Wrapper

I run the following to train a wrapped model from some task. I want to get the hyper-parameters from the wrapper. I tried the following
library(mlr)
lrn = makeLearner("classif.ksvm")
lrn = ...

**0**

votes

**1**answer

104 views

### Performing multiclass PLS-DA with mlr package in R

I want to use partial least squares discriminant analysis (PLS-DA) to solve a classification problem where there are multiple classes to be predicted. I know PLS-DA is not limited to the two class ...

**1**

vote

**1**answer

26 views

### plotTuneMultiCritResult does not work with TuneMultiCritControlMBO

I am trying to plot the Pareto front of a TuneMultiCritResult object, tuned with a control object of class TuneMultiCritControlMBO:
# multi-criteria optimization of (tpr, fpr) with MBO
lrn = ...