Skip to contents

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

  • lambda is initialized to 0.01, because the upstream function has no default for it. The value should be tuned.

  • scaling is initialized to FALSE, the upstream default is TRUE. With scaling, the features and the target of each subset are divided by the number of rows of the subset, so that a suitable lambda depends 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

  • G is 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. If G is not set, all pairs of subsets are fused with strength 1.

  • intercept fits one unpenalized intercept per subset if TRUE. The intercept that glmnet::glmnet() would fit across all subsets is always disabled, because the upstream function discards it.

  • lambda must be a single value, the upstream function accepts a vector.

Dictionary

This Learner can be instantiated via lrn():

lrn("regr.fuser")

Meta Information

Parameters

IdTypeDefaultLevelsRange
GuntypedNULL-
gammanumeric1\([0, \infty)\)
interceptlogicalFALSETRUE, FALSE-
lambdanumeric-\([0, \infty)\)
penalty.factorsuntyped--
scalinglogicalTRUETRUE, 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

Author

EngineerDanny

Super classes

mlr3::Learner -> mlr3::LearnerRegr -> LearnerRegrFuser

Methods

Inherited methods


LearnerRegrFuser$new()

Creates a new instance of this R6 class.

Usage


LearnerRegrFuser$clone()

The objects of this class are cloneable with this method.

Usage

LearnerRegrFuser$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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