Least-Angle Regression (LARS) package

Hello
I need LARS method and fortunately a package is (was?) available… Unfortunately is has not been updated since several years, so I download the code, remove the call for ArrayViews package which is outdated and does not seems to be used inside the LARS function, and then Julia wasn’t able to compile it localy. damned. Off course I sent an email to LARS package creator, but without success :frowning: .
Can anyone help me to update LARS so that it works again ?
Thank you for the help !
Fred

There’s some really old syntax in that package. From just a brief look:

  1. Replace immutable with struct

  2. Change foo{T}(x::T) to foo(x::T) where {T}

  3. Base.LinAlg is now LinearAlgebra and Ac_ldiv_B! is just ldiv! or something (search in the LinearAlgebra module).

Then a more general advice for dealing with old (pre-1.0 packages):

Install Julia version 0.7, and try to run the code. That version will produce a lot of deprecation warnings telling you how to update the code to something that will work under Julia v1.

2 Likes

thx a lot, I can’t access the julia computer now, will definitively try it tomorrow.
can you confirm the ArrayViews call wasn’t needed too?

I don’t know that package, but from here: https://github.com/JuliaArrays/ArrayViews.jl, it seems out of date. You should probably just use regular view from Base (no import required.)

Could you share a link to the package you downloaded?
Also, are you after solving the whole path, is that why you chose the LARS method?

well, here is the package I downloaded
https://github.com/simonster/LARS.jl
and yes, I am solving the whole path. In fact I want to plug the LARS package with the PCE package to have a LARS-PCE approach working

I have modified the code, but the import section which refers to

import Base.LinAlg.BlasReal

and then used in

… where {T<:BlasReal}

tricks me. I think I have to import

LinearAlgebra.BLAS

instead, but then how to modify the code so that it checks matrices are BLAS type compatible like it did before ??

Thank you !

I took a quick look and (I think?) successfully upgraded the package to Julia 1.x (at least, its tests pass):

https://github.com/simonster/LARS.jl/pull/8

4 Likes

strange, as it’s not suppose to… when trying to compile it locally it fails (Julia 1.6.2)

using LARS
ERROR: Failed to precompile LARS [top-level]

Have a look at @tlienart
https://github.com/JuliaAI/MLJLinearModels.jl

Would be good if we try to keep relevant models in a relatively small number of high-exposure, community maintained packages, if possible

You need to pull my branch:

(@v1.6) pkg> add https://github.com/stevengj/LARS.jl#sgj/julia1

thanks, but no LARS yet implemented, true ?

1 Like

julia> (@v1.6) pkg> add GitHub - stevengj/LARS.jl: Least angle regression and the lasso covariance test
ERROR: syntax: extra token “pkg” after end of expression
Stacktrace:
[1] top-level scope
@ none:1

did I miss something ??

That command (@v1.6) pkg> add ... is in the “Package mode” of the REPL. You can access it by typing in ] at the REPL.

1 Like

:grinning_face_with_smiling_eyes: use to play with 'using Pkg; Pkg.add(“something”)… successfully download the git !

No. I linked MLJLinearModels.jl to suggest a place to move LARS.jl & related packages in the future

I looked into adding LARS into MLJLinearModels but it’s a bit of a different beast in that all models in MLJLM (currently) correspond to an optimisation problem of the form min (Loss+Penalty). afaiu LARS is not like that (kindly correct me if I’m wrong).

I’d still be in favour of expanding MLJLM and LARS (or stuff like RANSAC) seem like good candidates, happy to brainstorm that somewhere with people keen to gather such models in one spot.

1 Like

sorry for my misunderstanding. Totally in line with you then :slight_smile: !

can’t you mimic the old LARS package we are trying to raise from its graveyard ?