Least-Angle Regression (LARS) package

The old LARS.jl has an MIT expat license
Should be no prob porting
If anyone here wants to PR

super ! I want to help w.r.t. my low level in Julia, how can I proceed ?

the point I was trying to make is that all models that are currently in MLJLM correspond to types or compositions of types to which there are a number of methods associated like objective. This is convenient because you can then throw any number of compatible optimisers at the problem. It also makes comparisons easier.

LARS to the best of my knowledge does not correspond to the minimisation of some loss, it’s just a procedure (at least as far as I can see from https://statweb.stanford.edu/~tibs/ftp/lars.pdf) also note that (again, as far as I’m aware) LASSO and LARS lead to similar results and LASSO is included in MLJLM (and I think it’s much faster to get the LASSO via FISTA than it is to get LARS).

Anyway as I said above, I’m not against adding LARS or RANSAC to MLJLM, maybe as a submodule or whatever. What you could do then is to take the code from LARS.jl, update it (or rewrite it) probably starting from Steven’s branch, maybe doing that in a separate repo so it’s easier to collaborate/review and once that works well then we can look into incorporating it into MLJLM.

1 Like

ok I get it. The LARS original code calls its covtest.jl own covariance function, do you think it’s better to keep it or rely on other newer code ?

If I were to do that, I’d start from scratch first with an eye on the paper so that you’re sure of each step of the algorithm, and use basic functions for each step as opposed to optimised or specific BLAS ones (some of the stuff in the LARS.jl code are optimisations that are not relevant anymore as far as I’m aware); then once you have something working that gives comparable results to sklearn, you can get people to help you review the code and help you make it more performant.

FWIW, the quick RCall.jl solution could be

julia> using RCall

R> library(glmnet); library(lars)
┌ Warning: RCall.jl: Loading required package: Matrix
│ Loaded glmnet 4.1-2
│ Loaded lars 1.2
│ 
└ @ RCall ~/.julia/packages/RCall/iMDW2/src/io.jl:160

R> data(QuickStartExample)

R> x <- QuickStartExample$x

R> y <- QuickStartExample$y


R> fit_lars <- lars(x, y, type = "lar", intercept = F, normalize = F)

R> fit_lars

Call:
lars(x = x, y = y, type = "lar", normalize = F, intercept = F)
R-squared: 0.917 
Sequence of LAR moves:
                                                          
Var  1 14 6 5 20 3 8 11 7 10 15  4 13 12  2  9 17 16 18 19
Step 1  2 3 4  5 6 7  8 9 10 11 12 13 14 15 16 17 18 19 20
3 Likes

thx a lot ! basically you call R inside Julia, isn’t it ?

exactly. it may be a way to get your application running quickly - of couse if your aim is to build a pure julia package, I don’t want to discourage you from that!

that’s exactly how it is. I think I will use your solution now to solve my problem while taking some time to try to build something relevant for the community

3 Likes

This is a working branch?
If yes, I might fork it and keep that version up.

As I wrote in my PR, the package tests pass, so it seems to be working at some level, but I haven’t performed any other validation. julia 1 compatibility by stevengj · Pull Request #8 · simonster/LARS.jl · GitHub

1 Like

Thanks. I took your version for a spin (comparing some of my own Convex.jl based code).

Seems to work well with Julia 1.7.3 (current packages) once iceil( is replaced by ceil(Int, in two places (lar.jl line 95 and covtest.jl line 21).

Suggestion to any future maintainer: can probably be released pretty soon, but it would be useful with an update of the documentation (in particular, how to extract/use the output).

3 Likes

Thanks, I updated my PR.

2 Likes