Lasso regression is a form of regression analysis used for variable selection and regularization. Use this tag for programming questions related to Lasso regression only. You can ask statistical questions on Cross Validated instead
Questions tagged [lasso-regression]
457 questions
4
votes
1 answer
Classification using LASSO framework
I am trying to determine the significance of my features in my classification using LASSO. However, I could not find any reference or guideline on doing so. I understand that LASSO mainly works for regressions, however, is there any way or any…

Sammy Vellu
- 139
- 1
- 5
4
votes
2 answers
How can we specify a custom lambda sequence to glmnet
I am new to the glmnet package in R, and wanted to specify a lambda function based on the suggestion in a published research paper to the glmnet.cv function. The documentation suggests that we can supply a decreasing sequence of lambdas as a…

user2758050
- 47
- 1
- 6
4
votes
0 answers
BIC to choose lambda in lasso regression
I know we can use GCV value to choose lambda in lasso regression. Can we also use BIC value to choose lambda in lasso regression? And how could I calculate BIC value with glmnet() in R?. I have read many lecture notes and they are all talking about…

aaa
- 251
- 3
- 11
4
votes
2 answers
what does the option normalize = True in Lasso sklearn do?
I have a matrix where each column has mean 0 and std 1
In [67]: x_val.std(axis=0).min()
Out[70]: 0.99999999999999922
In [71]: x_val.std(axis=0).max()
Out[71]: 1.0000000000000007
In [72]: x_val.mean(axis=0).max()
Out[72]:…

Donbeo
- 17,067
- 37
- 114
- 188
3
votes
1 answer
Is there a way to get all computed coefficients in a GridSearchCV?
I am trying different ML models, all using a pipeline which includes a transformer and an algorithm, 'nested' in a GridSearchCV to find the best hyperparameters.
When running Ridge, Lasso and ElasticNet regressions, I would like to store all the…

Greg Mansio
- 109
- 5
3
votes
2 answers
Updating Python sklearn Lasso(normalize=True) to Use Pipeline
I am new to Python. I am trying to practice basic regularization by following along with a DataCamp exercise using this…

TMo
- 435
- 4
- 11
3
votes
1 answer
Consistent "Error: All columns selected for the step should be numeric" in attempted LASSO model within R tidymodels
Trying to run my first LASSO model and running into a few issues. I have a medical dataset where I am trying to predict a dichotomous outcome (the disease) from about 60 predictors. I get as far as tuning the grid before I get the error "All columns…

Ryan
- 51
- 5
3
votes
1 answer
GridSearchCV gives different results than LassoCV for optimal alpha
I am aware of the standard process of finding the optimal value of alpha/lambda using Cross Validation technique through GridSearchCV class in sklearn.model_selection library.Here's my code to find that .
alphas=np.arange(0.0001,0.01,0.0005)
…

Rahul Ranjan
- 1,028
- 1
- 10
- 27
3
votes
1 answer
Why does sklearn's Lasso coefficients not equal to Linear Regression ones?
I am trying to implement sklearn's lasso in my code. To test it out, I have decided to make a test with alpha = 0. This should by definition yield the same result as LinearRegression, but this is not the case.
Here is the code:
import pandas as…

user9102437
- 600
- 1
- 10
- 24
3
votes
0 answers
How to access and compare LASSO model coefficients with MLR3 (glmnet learner)?
Goal
Create a LASSO model using MLR3
Use nested CV with inner CV or bootstraps for hyperparameter (lambda) determination and outer CV for model performance evaluation (instead of doing just one test-train spit) and finding the standard deviation of…

Shudras
- 117
- 2
- 8
3
votes
1 answer
How to do nested cross-validation with LASSO in caret or tidymodels?
Goal
I'd like to implement a LASSO model and check its viability on a training set according to the schematic shown here. (Schematic destription: all data is split into testing and training sets. The training set is split via 5-fold cross-validation…

Shudras
- 117
- 2
- 8
3
votes
0 answers
What exactly does the "weights" argument do in glmnet?
As the title indicates, I'm wondering what the exact impact of defining weights is in the glmnet package for R.
I'm working with survey data that contains design weights to correct for low/high probability that a certain individual will be sampled.…

FSS
- 31
- 2
3
votes
1 answer
Lasso regression won't remove 2 features which are highly correlated
I have two features, say F1 and F2 which has a correlation of about 0.9.
When I built my model, I first considered all the features to go into my regression model. Once I have my model, I then ran Lasso regression on my model, with the hope that…

Leockl
- 1,906
- 5
- 18
- 51
3
votes
2 answers
Overfitting the Lasso regression model to the data
I wanted to create a model that would describe the behaviour of my data. I tried the simple linear regression, simple polynomial regression and polynomial regression with regularization and cross-validation.
I found that the last method allows an…

Chanski
- 63
- 1
- 8
3
votes
1 answer
select best parameters for regression model using Gridsearch
I'm doing linearregression modeling and i used gridsearch for select best parameters. below python steps i followed for this work but i got error (ValueError: Invalid parameter alpha for estimator LinearRegression(copy_X=True, fit_intercept=True,…

randunu galhena
- 159
- 1
- 5
- 14