Fused lasso regression over subsets of the data.
One linear model is fitted per subset, and an L2 fusion penalty shares information between the coefficients
of the subsets.
Calls fuser::generateBlockDiagonalMatrices() and fuser::fusedL2DescentGLMNet() from fuser.
Subsets
The learner requires a task with exactly one column with the column role "subset", which assigns each row to
a subset.
The "subset" role is registered by mlr3resampling, so that package has to be loaded before the role
can be set, e.g. with task$set_col_roles("column", roles = "subset").
There must be at least two subsets in the training data, and predictions are only possible for subsets that
were present during training.
The "group" role is not used because mlr3 keeps the rows of a group together when resampling,
so that the test set would only contain subsets that the model has not seen.
Initial parameter values
lambdais initialized to 0.01, because the upstream function has no default for it. The value should be tuned.scalingis initialized toFALSE, the upstream default isTRUE. With scaling, the features and the target of each subset are divided by the number of rows of the subset, so that a suitablelambdadepends strongly on the number of rows and the initial value would shrink all coefficients to zero on all but very small data sets.
Custom mlr3 parameters
Gis the matrix of pairwise fusion strengths between the subsets. Rows and columns are aligned with the subset names, which are converted to character and sorted. IfGis not set, all pairs of subsets are fused with strength 1.interceptfits one unpenalized intercept per subset ifTRUE. The intercept thatglmnet::glmnet()would fit across all subsets is always disabled, because the upstream function discards it.lambdamust be a single value, the upstream function accepts a vector.
Meta Information
Task type: “regr”
Predict Types: “response”
Feature Types: “logical”, “integer”, “numeric”
Required Packages: mlr3, mlr3extralearners, fuser, mlr3resampling
Parameters
| Id | Type | Default | Levels | Range |
| G | untyped | NULL | - | |
| gamma | numeric | 1 | \([0, \infty)\) | |
| intercept | logical | FALSE | TRUE, FALSE | - |
| lambda | numeric | - | \([0, \infty)\) | |
| penalty.factors | untyped | - | - | |
| scaling | logical | TRUE | TRUE, FALSE | - |
References
Dondelinger, Frank, Mukherjee, Sach, Initiative TADN (2020). “The joint lasso: high-dimensional regression for group structured data.” Biostatistics, 21(2), 219–235. doi:10.1093/biostatistics/kxy035 .
See also
as.data.table(mlr_learners)for a table of available Learners in the running session (depending on the loaded packages).Chapter in the mlr3book: https://mlr3book.mlr-org.com/chapters/chapter2/data_and_basic_modeling.html#sec-learners
mlr3learners for a selection of recommended learners.
mlr3cluster for unsupervised clustering learners.
mlr3pipelines to combine learners with pre- and postprocessing steps.
mlr3tuning for tuning of hyperparameters, mlr3tuningspaces for established default tuning spaces.
Super classes
mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrFuser
Methods
Inherited methods
mlr3::Learner$base_learner()mlr3::Learner$configure()mlr3::Learner$encapsulate()mlr3::Learner$format()mlr3::Learner$help()mlr3::Learner$predict()mlr3::Learner$predict_newdata()mlr3::Learner$print()mlr3::Learner$reset()mlr3::Learner$selected_features()mlr3::Learner$train()mlr3::LearnerRegr$predict_newdata_fast()
Examples
# Load mlr3resampling to register the "subset" column role
library(mlr3resampling)
# Define the Learner
learner = lrn("regr.fuser", lambda = 0.001, gamma = 0.01)
print(learner)
#>
#> ── <LearnerRegrFuser> (regr.fuser): Fused Lasso ────────────────────────────────
#> • Model: -
#> • Parameters: gamma=0.01, lambda=0.001, scaling=FALSE
#> • Packages: mlr3, mlr3extralearners, fuser, and mlr3resampling
#> • Predict Types: [response]
#> • Feature Types: logical, integer, and numeric
#> • Encapsulation: none (fallback: -)
#> • Properties:
#> • Other settings: use_weights = 'error', predict_raw = 'FALSE'
# Define a Task, the number of cylinders assigns the rows to subsets
task = tsk("mtcars")
task$set_col_roles("cyl", roles = "subset")
# Create train and test set, each subset is present in both sets
task$col_roles$stratum = "cyl"
ids = partition(task)
# Train the learner on the training ids
learner$train(task, row_ids = ids$train)
# Coefficients per subset
print(learner$model)
#> 4 6 8
#> am 0.00000000 0.000000000 0.00000000
#> carb 0.00000000 0.433692827 -1.21557270
#> disp -0.13203506 0.006743088 -0.02255833
#> drat 0.00000000 0.186257594 0.00000000
#> gear 2.61380811 0.000000000 0.43646975
#> hp -0.00617988 0.026256584 0.04477046
#> qsec 1.64238148 0.767722273 0.95644504
#> vs 0.00000000 0.000000000 0.00000000
#> wt 0.00000000 0.000000000 0.00000000
# Make predictions for the test rows
predictions = learner$predict(task, row_ids = ids$test)
# Score the predictions
predictions$score()
#> regr.mse
#> 8.031302