Questions tagged [lasso-regression]

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

457 questions
3
votes
2 answers

lambda.1se not being in one standard error of the error

In the documentation of the function cv.glmnet(), it is given that: lambda.1se : largest value of lambda such that error is within 1 standard error of the minimum. Which means that lambda.1se gives the lambda, which gives an error (cvm) which is…
Mooncrater
  • 4,146
  • 4
  • 33
  • 62
3
votes
2 answers

R - Extract factor predictor names from caret and glmnet lasso model object

In the below example, I set up a df with 3 variables, predict, var1, and var2 (a factor). When I run a model in caret or glmnet, the factor is converted into a dummy variable, such as var2b. I'd like to extract the variable names programmatically…
BigTimeStats
  • 447
  • 3
  • 12
3
votes
2 answers

Python LASSO maximum number of non-zero coefficients

I have a substantially large dataset which includes more than 100 coefficients and thousands of entries. Therefore, I would like to use the Lasso approach for model training. I am currently looking into the sci-kit documentation…
frek13
  • 162
  • 3
  • 8
3
votes
2 answers

Python sklearn. Why I received warnings first time only?

I received warnings first time only. Is this normal? >>> cv=LassoCV(cv=10).fit(x,y) C:\Python27\lib\site-packages\scikit_learn-0.14.1-py2.7-win32.egg\sklearn\linear_model\coordinate_descent.py:418: UserWarning: Objective did not converge. You might…
Donbeo
  • 17,067
  • 37
  • 114
  • 188
3
votes
1 answer

negative value for "mean_squared_error"

I am using scikit and using mean_squared_error as a scoring function for model evaluation in cross_val_score. rms_score = cross_validation.cross_val_score(model, X, y, cv=20, scoring='mean_squared_error') I am using mean_squared_error as it is a…
user644745
  • 5,673
  • 9
  • 54
  • 80
3
votes
2 answers

Error in cv.lars in R

I have a question regarding the cv.lars. Bellow there is a description for the data I use: is.numeric(Y$Y1) [1] TRUE length(Y$Y1) [1] 589 dim(Training_XX[7:ncol(Training_XX)]) [1] 589 5677 I have already run lasso using lars package. My code is…
Danai C.
  • 125
  • 4
  • 8
2
votes
0 answers

How to calculate the marginal effect of lasso logistic regression?

I have seen the method of calculating marginal effect for glm, gam and polr packages, but how to calculate marginal effect for lasso regression, such as glmnet packages? Is it extracting the coefficients of lasso regression and then calculating the…
jiyuan min
  • 21
  • 1
2
votes
1 answer

How can I pass an extra variable to a tidymodels fit function?

I am writing a tidymodels engine to fit the joint LASSO described here and implemented in the fuser package. This is a LASSO model for regression that allows partial sharing of information between groups, in this case tissues in a biomedical RNAseq…
alan ocallaghan
  • 3,116
  • 17
  • 37
2
votes
0 answers

lasso regression for larger datasets using dask

I'm attempting to perform a lasso regression for a larger than main memory dataset by using Dask, but there doesn't seem to be a cleanly documented way to do so. I did previously find a somewhat related question but no actual answer. Looking into…
2
votes
1 answer

sklearn for LASSO (BIC tuning)

We encounter a problem when using the LASSO-related function in sklearn. Since the LASSO with BIC tuning just change the alpha, the results of LASSO with BIC (1) should be equivalent to the LASSO with fixed optimal alpha…
2
votes
1 answer

glmnet: at what lambda is each coefficient shrunk to 0?

I am using LASSO (from package glmnet) to select variables. I have fitted a glmnet model and plotted coefficients against lambda's. library(glmnet) set.seed(47) x = matrix(rnorm(100 * 3), 100, 3) y = rnorm(100) fit = glmnet(x, y) plot(fit, xvar =…
2
votes
1 answer

Ordinal logistic regression (or Beta regression) with a LASSO regularization in R?

I was wondering if someone would know an R package that would allow me to fit an Ordinal Logistic regression with a LASSO regularization or, alternatively, a Beta regression still with the LASSO? And if you also know of a nice tutorial to help me…
2
votes
1 answer

How to add an L1 penalty to the loss function for Neural ODEs?

I've been trying to fit a system of differential equations to some data I have and there are 18 parameters to fit, however ideally some of these parameters should be zero/go to zero. While googling this one thing I came across was building DE layers…
2
votes
0 answers

Error in cbind2(1, newx) %*% nbeta : Cholmod error- Lasso Regression Error in R

I'm working on predicting a regression model on Lasso. I have a total of 137 train data, and 100000 test data to predict the total revenue. to build the model I split train data into train and test ( train = 96, test = 97-137). When I ran the lasso…
Ekram Diab
  • 21
  • 1
2
votes
0 answers

Image reconstruction with compressed sensing

I'm trying to code a demonstration of compressed sensing for my final year project but am getting poor image reconstruction when using the Lasso algorithm. I've relied on the following as a reference:…