# Least-Angle Regression (LARS) package

**URL:** <https://discourse.julialang.org/t/least-angle-regression-lars-package/68424>\
**Category:** Optimization (Mathematical)\
**Created:** [September 19, 2021, 8:23pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424 "2021-09-19T20:23:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 19, 2021, 8:23pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/1 "2021-09-19T20:23:55Z")

</div>

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 ☹ .  
Can anyone help me to update LARS so that it works again ?  
Thank you for the help !  
Fred

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [September 19, 2021, 8:57pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/3 "2021-09-19T20:57:30Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [September 19, 2021, 9:04pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/4 "2021-09-19T21:04:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 19, 2021, 9:10pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/5 "2021-09-19T21:10:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [September 19, 2021, 9:19pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/6 "2021-09-19T21:19:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [September 20, 2021, 5:10am UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/7 "2021-09-20T05:10:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 5:57am UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/8 "2021-09-20T05:57:24Z")

</div>

well, here is the package I downloaded  
[https://github.com/simonster/LARS.jl](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](https://www.sciencedirect.com/science/article/pii/S0021999110006856) approach working

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 2:01pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/9 "2021-09-20T14:01:13Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 20, 2021, 3:35pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/10 "2021-09-20T15:35:16Z")

</div>

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](https://github.com/simonster/LARS.jl/pull/8)

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 3:50pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/11 "2021-09-20T15:50:43Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [September 20, 2021, 4:00pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/12 "2021-09-20T16:00:56Z")

</div>

Have a look at @tlienart  
[https://github.com/JuliaAI/MLJLinearModels.jl](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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 20, 2021, 4:05pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/13 "2021-09-20T16:05:04Z")

</div>

> [@Frederic\_Gilt](#):
>
> strange, as it’s not suppose to… when trying to compile it locally it fails (Julia 1.6.2)

You need to pull my branch:

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

```

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 4:25pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/14 "2021-09-20T16:25:51Z")

</div>

thanks, but no LARS yet implemented, true ?

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 4:34pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/15 "2021-09-20T16:34:08Z")

</div>

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

did I miss something ??

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [September 20, 2021, 4:39pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/16 "2021-09-20T16:39:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 4:42pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/17 "2021-09-20T16:42:16Z")

</div>

> [@stevengj](#):
>
> `add https://github.com/stevengj/LARS.jl#sgj/julia1`

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

---

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [September 20, 2021, 5:19pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/18 "2021-09-20T17:19:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [September 20, 2021, 6:31pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/19 "2021-09-20T18:31:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 6:54pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/20 "2021-09-20T18:54:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Frederic\_Gilt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frederic_gilt/32/13807_2.png) [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Post date:** [September 20, 2021, 7:08pm UTC](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424/21 "2021-09-20T19:08:49Z")

</div>

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

[Next page](https://discourse.julialang.org/t/least-angle-regression-lars-package/68424.md?page=2)
