Skip to content

Conversation

@EngineerDanny
Copy link

Summary

Adds a new regression learner regr.fuser that wraps the fused Lasso model from fuser and requires a single grouping column via the group role.

Implementation Details

  • New learner: LearnerRegrFuser
  • Backend: fuser::fusedL2DescentGLMNet(X, y, groups, lambda, G, gamma, scaling)
  • Requires exactly one grouping column via the group role
  • Defaults: lambda = NULL, gamma = 1, scaling = FALSE, G = NULL (defaults to all-ones K×K)
  • Errors on unseen groups at prediction time
  • Validates scalar lambda, gamma, and G dimensions
  • Tests for happy path + validation cases

Example

library(mlr3)
library(mlr3extralearners)

data = data.frame(
  y = rnorm(20),
  x1 = rnorm(20),
  x2 = rnorm(20),
  group = rep(c("A", "B"), each = 10)
)

task = TaskRegr$new(id = "fuser", backend = data, target = "y")
task$set_col_roles("group", roles = "group")

learner = lrn("regr.fuser", lambda = 0.01, gamma = 0.01, scaling = FALSE)
learner$train(task)
pred = learner$predict(task)

Tests

  • Rscript -e 'testthat::test_file("tests/testthat/test_fuser_regr_fuser.R")'

Notes

  • Requires fuser (GitHub fork): remotes::install_github("EngineerDanny/fuser")

Closes #426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LRNRQ] Add <algorithm> from package fuser

1 participant