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
0
votes
1 answer
Lasso.py is not included in github.com/scikit-learn
I am trying to find Lasso.py on GitHub, I believe I should be able to find it at https://github.com/scikit-learn/scikit-learn/tree/main/sklearn/linear_model; but it is not there. Does anyone have an idea?

Massoud
- 503
- 4
- 13
0
votes
1 answer
lassoshooting and glmnet different results
I want to compare lassoshooting and glmnet for lasso.
No standardization option in lassoshooting; so i standardized data first, fit the model and re-standardized to original scale.
Results are different and it seems lassoshooting beta's is closer…

mert
- 371
- 2
- 9
0
votes
1 answer
How to calculate the cross-validated R2 on a LASSO regression?
I am using this code to fit a model using LASSO regression.
library(glmnet)
IV1 <- data.frame(IV1 = rnorm(100))
IV2 <- data.frame(IV2 = rnorm(100))
IV3 <- data.frame(IV3 = rnorm(100))
IV4 <- data.frame(IV4 = rnorm(100))
IV5 <- data.frame(IV5 =…

Dave
- 111
- 2
- 11
0
votes
1 answer
How to specify chosen lambda to fit lasso in R
I have found my best lambda(for lasso) through 10 fold cross validation on my training data set and validated with testing dataset. Now I would like to use my best lambda to fit a model on the whole dataset(using both training and test). How do I…

jijforu
- 5
- 4
0
votes
1 answer
scikit learn elastic net with log regression
I would like to use scikit's package elastic net with a log regression. This is what I am doing so far:
from sklearn.linear_model import ElasticNet
enet = ElasticNet(alpha=alpha, l1_ratio=0.7)
y_enet = enet.fit(X_train, y_train)
Is…

Niccola Tartaglia
- 1,537
- 2
- 26
- 40
0
votes
0 answers
Adaptive Lasso for Times Series
I have a series of 700 possibles variables to explain (Y), all of them are continuous variables. Those 700 variables are lagged and new lagged variables for the last 12 months are calculated, so from the initial 700 we end up with 8200 possible…

Luis Carmona Martinez
- 119
- 12
0
votes
0 answers
RMSE error doesn't converge towards the same value depending on the train/test ratio
I am trying to find a reliable testing method to compute the error of my model / training parameters, but I am seeing weird results when I play with the train/test ratio.
When I change the ratio of my train/test data, the RMSE converges towards…

benji
- 2,331
- 6
- 33
- 62
0
votes
1 answer
glmnet, multinomial prediction returned object
I am attempting to do classification prediction using glmnet, however I cannot deduce what the return object of "glmnet.predict" is supposed to represent. Using the code
mlogit_r<-glmnet(train_x, cbind(cns_label,…

user3707850
- 73
- 3
- 8
0
votes
1 answer
lasso regression prediction ignores index
I am building a ridge and lasso regression on the same dataset, however lasso model's prediction's shape seems different than ridge. I'd appreciate if someone can explain what I'm doing wrong...
###Ridge Regression
model3 =…

Cagdas Kanar
- 713
- 4
- 13
- 23
0
votes
1 answer
Using glmnet to predict a continuous variable in a dataset
I have this data set.
wbh
I wanted to use the R package glmnet to determine which predictors would be useful in predicting fertility. However, I have been unable to do so, most likely due to not having a full understanding of the package. The…

Srikar Murali
- 135
- 2
- 15
0
votes
1 answer
Access the regularization paths obtained from ElasticNetCV in sklearn
I would like to get these plots:
http://scikit-learn.org/stable/auto_examples/linear_model/plot_lasso_coordinate_descent_path.html
from an elastic net I have already trained.
The example does
from sklearn.linear_model import lasso_path,…

00__00__00
- 4,834
- 9
- 41
- 89
0
votes
0 answers
why all of the coefficients estimated by lasso are zero?
I'm new to R and want to implement lasso on my data in order to feature selection according to the coefficient estimated by this algorithm. My data base is big and There are 40 predictors(continuous and categorical).when I apply lasso regression…

far
- 321
- 2
- 5
- 11
0
votes
2 answers
Using glmnet on binomial data error
I imported some data as follows
surv <- read.table("http://www.stat.ufl.edu/~aa/glm/data/Student_survey.dat",header = T)
x <- as.matrix(select(surv,-ab))
y <- as.matrix(select(surv,ab))
glmnet::cv.glmnet(x,y,alpha=1,,family="binomial",type.measure =…

Alex
- 2,603
- 4
- 40
- 73
0
votes
0 answers
How to apply lasso regression through cellfun in matlab
I have 2 sets (X and Y) of 9x714 cell arrays where inside the cells consist of various dimension of matrices and empty ones. Cell array X and Y are symmetrical for matrix dimensions. I would like to use cellfun to apply lasso regression.
[B…

Riano
- 1
0
votes
0 answers
Why LASSO selects intercept only?
I am doing a projects using glmnet package and have hard time to interpret the result.
The scenario as follows.
There are 7 variables x1, ..., x7.
x3, ... , x7 are scaled to mean 0 and std 1.
I fit a Lasso regression on x3, ... , x7. Lasso selects…

Stella Hu
- 353
- 5
- 9