# LASSO.jl, GLMNet.jl - hyperparameters

**URL:** https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799
**Category:** Machine Learning
**Created:** [September 15, 2019, 9:19pm UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799 "2019-09-15T21:19:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![versipellis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/versipellis/32/7878_2.png) [@versipellis](https://discourse.julialang.org/u/versipellis)
#### Post date: [September 15, 2019, 9:19pm UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/1 "2019-09-15T21:19:46Z")

</div>

I’m not seeing any documentation for such, but in `LASSO.jl` and `GLMNet.jl`, I’m looking to do the following:

1. Specify a validation set to train hyperparameters on, rather than just using cross-validation. I know CV is better, but I’m looking to do this for academic reasons.
2. Train, either with CV or with a specified validation set, the alpha hyperparameter for ElasticNet.

How would I do either of these?

---

<div class="post-metadata">

### Author: ![Nosferican](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nosferican/32/9275_2.png) [@Nosferican](https://discourse.julialang.org/u/Nosferican)
#### Post date: [September 17, 2019, 5:25pm UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/2 "2019-09-17T17:25:08Z")

</div>

Have you looked at  
[https://github.com/alan-turing-institute/MLJ.jl](https://github.com/alan-turing-institute/MLJ.jl)  
?

---

<div class="post-metadata">

### Author: ![versipellis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/versipellis/32/7878_2.png) [@versipellis](https://discourse.julialang.org/u/versipellis)
#### Post date: [September 17, 2019, 6:09pm UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/3 "2019-09-17T18:09:28Z")

</div>

I have not, in depth, for this use case. MLJ has always appeared pretty daunting to me.

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [September 18, 2019, 12:38am UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/4 "2019-09-18T00:38:35Z")

</div>

Not gonna lie I felt the same way when I saw it, and haven’t thought of using it since… These are pretty elementary usage questions that I think the package maintainer or docs should be able to answer. Have you tried filing an issue?

My package has some lightweight classification/regression statistics if you need them ([GitHub - caseykneale/ChemometricsTools.jl: A collection of tools for chemometrics and machine learning written in Julia.](https://github.com/caseykneale/ChemometricsTools.jl)) and also some sampling tools(random splits, kennard stone, cv, venetian blinds, etc). No LASSO, I don’t think? but I could do a really quick and dirty implementation in like 20 minutes if you’re desperate. It wouldn’t be world class though…

---

<div class="post-metadata">

### Author: ![anon92994695](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@anon92994695](https://discourse.julialang.org/u/anon92994695)
#### Post date: [September 18, 2019, 12:43am UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/5 "2019-09-18T00:43:52Z")

</div>

> [@versipellis](#):
>
> GLMNet.jl

Alright so GLMNet has zero documentation - classy.

But as far as Lasso.jl goes, I think this page will help: [Home · Lasso.jl](https://juliastats.github.io/Lasso.jl/stable/#Quick-start-1)

---

<div class="post-metadata">

### Author: ![versipellis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/versipellis/32/7878_2.png) [@versipellis](https://discourse.julialang.org/u/versipellis)
#### Post date: [September 19, 2019, 6:23pm UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/6 "2019-09-19T18:23:44Z")

</div>

I pored through all of the documentation for both, prior to posting this. From what I inferred after, though, GLMNet’s fortran code doesn’t support hyperparameter tuning using a validation set.

I’m revisiting MLJ again, though, and it looks a lot more advanced than when I had first looked at it. Bringing in the scikitlearn.jl models was awesome.

---

<div class="post-metadata">

### Author: ![Saptarshi\_Ghosh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/saptarshi_ghosh/32/14300_2.png) [@Saptarshi\_Ghosh](https://discourse.julialang.org/u/Saptarshi_Ghosh)
#### Post date: [September 30, 2020, 9:35am UTC](https://discourse.julialang.org/t/lasso-jl-glmnet-jl-hyperparameters/28799/7 "2020-09-30T09:35:34Z")

</div>

Although GLMNet.jl has minimum explanations, Extensive documentation is available for its [Python](https://web.stanford.edu/~hastie/glmnet_python/index.html), [R](https://cran.r-project.org/web/packages/glmnet/vignettes/glmnet.pdf) and [Matlab](http://web.stanford.edu/~hastie/glmnet_matlab/) versions.

As far as GLMNet.jl in Julia (which is just a wrapper) goes, [Python documentation](https://github.com/bbalasub1/glmnet_python) should be a good place to start. The rest should be similar.
