Giter Site home page Giter Site logo

ddegras / sparsegfl Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 3.05 MB

Hybrid Approach to Sparse Group Fused Lasso

License: MIT License

R 42.53% C++ 57.47%
fused-lasso segmentation multivariate-timeseries convex-optimization hybrid-algorithms proximal-operators fixed-point-iteration sparse-regression

sparsegfl's Introduction

sparseGFL

Hybrid Approach to Sparse Group Fused Lasso

Fast hybrid algorithm for joint model segmentation and sparse estimation in high-dimensional piecewise linear regression models.
The algorithm finds global solutions to the sparse group fused lasso (SGFL) problem whose objective function is the sum of a squared loss function (to control fit to the data), an elastic net penalty (to promote sparsity in regression coefficients), and a total variation penalty (to promote parsimony in detected change points or segments).

Package installation

install.packages(c("foreach", "glmnet", "Matrix", "Rcpp", "RcppArmadillo")) # package dependencies and imports
install.packages("devtools")
library(devtools)  
install_github("ddegras/sparseGFL") 

Main functions

  • SGFL: solve SGFL for piecewise regression model y(t) = X(t) b(t) + e(t) (matrix predictors X, vector regression coefficients b)
  • SGFL.AXY: solve SGFL for piecewise regression model y(t) = A(t) x(t) + e(t) (vector predictors x, matrix regression coefficients A)
  • SGFL.VAR: solve SGFL for piecewise vector autoregressive (VAR) model y(t) = A1(t) y(t-1) + ... + Ap(t) y(t-p) + e(t)

Reference

Degras, D. "Sparse group fused lasso for model segmentation: a hybrid approach." Advances in Data Analysis and Classification 15, 625โ€“671 (2021).

sparsegfl's People

Contributors

ddegras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sparsegfl's Issues

Documentation

I've tested out your spatiotemporal lasso, and it is fantastically fast. Two questions:

  1. Using the below code, how does one actually plot out the results? I see the beta matrix there, in the results, after this code, but it's not conformable with the X matrix, so unlike the genlasso package... I can't exactly plot the results.
    `
    m <- 5 # number of (time-varying) observation variables
    n <- 100 # time series length
    p <- 10 # number of (time-varying) predictor variables

x <- array(rnorm(mnp),c(m,p,n)) # random coefficients
beta <- matrix(0,p,n) # random coefficients with 50% sparsity
beta[1:5,1:50] <- runif(5) # and one change point at time 51
beta[6:p,51:n] <- runif(5)
y <- matrix(,m,n)
for (i in 1:n){ y[,i] <- x[,,i] %*% beta[,i] + rnorm(m,sd=.01)}

lambda1 <- .05
lambda2 <- 1.5
alpha <- .9

result <- SGFL(x, y, lambda1, lambda2, alpha,
intercept=FALSE, verbose=TRUE)

`
2. Is there an example that uses parallelization? Does one do this with SNOW?

type definitions not known

What are the definitions of the types
mat (a 2 dimensional array?)
cube (a 3 dimensional array?)
uword (an integer?)
in the allmethods.cpp?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.