Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [glmnet]

R package for lasso and elastic-net regularized generalized linear models.

0
votes
0answers
8 views

Why with glmnet I obtain different coefficients for the different categories I want to classify?

I am performing a multinomial logistic regression using glmnet. I have 7 classes of trees to predict and different predictors. What I do not understand is why when I plot the coefficents vs. log ...
0
votes
0answers
14 views

Confused about hyperparameter selection for elastic net regularization using glmnet

I am following the glmnet tutorial here and confused about the statement: We see that lasso (alpha=1) does about the best here. We also see that the range of ...
1
vote
0answers
24 views

R squared / deviance explained for elastic net glmnet

I am using R glmnet function for the elastic net for logistic regression with binary outcome and would like to calculate the R-square value. I am getting different results when I use the dev.ratio ...
2
votes
1answer
16 views

What value of alpha should I choose regularization

What value of alpha should I choose in glmnet? Should I use one which minimizes the cross-validation error, one which is one standard deviation above or below the one which gives the best error (like ...
0
votes
2answers
46 views

k-fold cross validation: Force at least m instances in each fold

I'm dealing with a multi-output regression problem (~ 800 dependent variables, ~ 1300 observations). My current approach is to train a single model for each output. To select an "optimal" lambda I ...
0
votes
0answers
16 views

How to give a represantation to veriables from each group using LASSO

I'm trying to apply LASSO regression on my data set in order to choose the best variables. However, my variables (44 to be accurate) come from 7 different groups, is there any option to give a "...
0
votes
0answers
28 views

glmnet: Nested cross validation, tuning alpha and lambda

I am trying to perform the nested cross validation with glmnet and I want to tune both alpha and lambda. I want to pass the algorithm a sequence of possible alphas and let it decide for the lambda ...
0
votes
0answers
17 views

Ridge analytically vs glmnet [duplicate]

With an outcome variable and two correlated regressors... ...
0
votes
0answers
24 views

CV.GLMNET warnings convergence

I get the warnings when I try to perform a cross validation with cv.glment for a Logistic penalized model ...
0
votes
0answers
29 views

Spline regression with many features in R

I have high-dimensional data that I'd like to fit a spline to then predict values given a held out set. I am currently fitting a linear regression model on my data via the ...
0
votes
0answers
75 views

Large Matrix to run cv.glmnet for multinomial

I am working on a large matrix with number of samples N=40 and features, P=7130. I am trying to fit the cv.glmnet() for the ridge but i am getting error while doing ...
0
votes
0answers
12 views

Are there any plots for the results of the Lasso estimator besides plotting the Lasso path?

When one reports the results of methods like Lasso, group Lasso or Stability Selection, are there any nice plots one could generate for genome-wide association studies (besides lasso paths) to make ...
2
votes
0answers
217 views

How do I compute the residuals from glmnet in r? [closed]

I am working with glmnet and i would like to compute the residuals for the model with lasso penalty. I've simulated data split into training and testing set. My ...
1
vote
0answers
80 views

How to use Elastic Net Model to Reduce Collinearity

I am using R to perform a linear regression with a dataset that has clearly correlated independent variables (collinearity). I am using the vif (variance inflation factor) function from the car ...
1
vote
0answers
32 views

How can I use the coefficient and important variables obtained from elastic net modelling [closed]

I have a big question here. Although I search over internet and also in research papers but couldn't find an answer to it. I ran elastic net over a dataset that had close to 300 variables and a ...
0
votes
0answers
24 views

Discrepancy between coefficients generated by cv.glmnet() and glmnet()?

I noticed small differences between the coefficients generated by cv.glmnet() and glmnet() when the same lambda was applied. I am wondering why this happens. Codes below will reproduce the phenomenon ...
-1
votes
1answer
102 views

cv.glmnet vs glm vs lm.ridge

I am currently trying to build a ridge regression model, and knows that the lm.ridge, glm and cv.glmnet functions can enable me to do so. However, I really do not know what are the differences between ...
1
vote
1answer
235 views

ridge and lasso models in caret with lambda=0

As far as I know, if I run a lasso model and a ridge model on the same data, and if i keep lambda=0, I'm getting the OLS. Then, how is it possible that I get different results? ...
2
votes
1answer
70 views

Ridge/Lasso for correlated response

I want to try a penalised linear regression (ridge/lasso) as a comparison to standard OLS for its predictive ability. My response variable is a continuous measure of an eye parameter, so there is (...
1
vote
0answers
77 views

cv.glmnet, minimal MSEis higher than OLS MSE

I have a data with multicollinearity. I can't exclude the correlated variable as they are my variable of interest. I therefore Used Ridge regression, and tried to find optimal lambda with CV. I face ...
0
votes
1answer
163 views

Multivariate Elastic Net with glmnet [closed]

I am using glmnet package for elastic net. I'd like to perform variable selection and classification on a 50x41 data set with 3 response variables (one continuous and two categorical), but I have not ...
0
votes
1answer
160 views

how to use method lasso in cox model using glmnet?

I have the survival data includes 252 patients, 25 independent variables and 35 events. I want to use lasso method in cox model to these data. I use glmnet for it. ...
0
votes
0answers
16 views

cv.glmnet error by class

I have a dataset which the response variables are class type. For cv.glmnet, I know it reports the overall error rate, but does it report error rate by each class? If not, what function works? I ...
0
votes
0answers
96 views

Feature selection using lasso with both continues and dummy variables?

My goal is to do feature selection for linear regression, the dataset contains both continues and dummy variables. I saw an example of sklearn that we can use LassoCV to do feature selection. However,...
0
votes
0answers
185 views

GLMNET: Weights and imbalanced data

I have a multinomial regression problem using glmnet. The training data is imbalanced (1:5:10 roughly). I tried over and undersampling already. Would providing ...
1
vote
0answers
345 views

Glmnet: How to select Lambda and Alpha

I'd like to pick the optimal lambda and alpha using the Glmnet package. I'm open to all models (Ridge, Lasso, Elastic). I'm assuming some out of sample error/cross validation is the best model ...
1
vote
0answers
83 views

Variable importance in the glmnet

I'm using R for machine learning. The objective is to classify the onset of disease (Two-class). Before conducting a machine learning algorithm, I ran the glmnet (to utilize elastic net) to reduce ...
0
votes
1answer
37 views

Predicting a Numeric value in Future Years

I have this data set, and I want to predict number of PTS beyond 2018: ...
0
votes
1answer
150 views

Q: Possible to optimize for area under the precision-recall curve in glmnet logistic regression?

tl;dr with the R glmnet package, is it possible to optimize for the area under the precision-recall curve, rather than the area ...
0
votes
0answers
33 views

Does caret support count/proportion response matrices for a glmnet binomial model?

I am trying to train a glmnet binomial model using caret. My data is pre-aggregated into a counts of successes and failures, and caret doesn't seem to like this although glmnet itself supports it. I ...
0
votes
0answers
29 views

does glmnet take more times than cv.glm?

Now, I'm interested in sparse data classification. My dataset is sparse matrix (about 5,000 rows and 5,000 columns). (Almost cells are 0 few cells is 1) And I used glmnet to to drop unnecessary ...
0
votes
0answers
32 views

A confirmation about elastic-net and lasso

I would like to confirm numerically that elastic-net and lasso are equivalent under a transformation on the data set using glmnet package in ...
2
votes
0answers
62 views

Confidence Interval for Multinomial Elastic Net Predicted Probabilities

I am building an application which involves multinomial logistic regression models with the elastic net penalty using the glmnet-library on automatically collected data in R. My interest in particular ...
0
votes
0answers
54 views

Equivalent of using a Poisson prior in terms of a penalized regression?

I know that most penalized regressions have also a Bayesian interpretation, e.g. ridge least squares regression corresponds to the MAP estimate obtained under a Gaussian prior in a Bayesian regression,...
1
vote
0answers
55 views

How to make multiple step ahead predictions with cv.glmnet object?

I am trying to make forecasts for a LASSO model obtained from the cv.glmnet() function ("glmnet" package). I most frequently make forecasts using the predict() function (in the "stats" package). For ...
4
votes
0answers
420 views

What is the difference between Lasso regression in glmnet (in R) and Sklearn lasso (in Python)?

A similar post was discussed here regarding Ridge Regression: What are the differences between Ridge regression using R's glmnet and Python's scikit-learn? My question is what is this ...
0
votes
1answer
27 views

Which Optimization Technique does CARET use when Training a Model, say glmnet? [closed]

I am trying to understand the mechanics behind the training of models. Specifically, I need to know how R's CARET package trains models. Which technique or algorithm is applied? Usually for linear ...
0
votes
0answers
176 views

Caret and glmnet giving different lambda and coefficient values

I need to match lambda and coefficient values from cv.glmnet and caret train functions. It is evident from below that both ...
1
vote
1answer
223 views

lasso vs linear regression comparison

I have a data set with more features than observations, i.e. $p>n$. Using Lasso regression with glmnet, the optimal selection of $\lambda$ from cross-validation ...
1
vote
0answers
71 views

Interpreting coefficents of elastic-net for ordered factors in R

I am currently learning the elastic-net package in R and optimizing it using caret. I read the book introduction to statistical ...
2
votes
1answer
296 views

glmnet LASSO regression only yields fitted coefficients equal 0

Here is the data set I'm working with: I'm trying to find the best possible multiple regression for R as dependent and the rest as independent variables. Here's what I did in R: ...
2
votes
1answer
2k views

Is the LASSO really applicable for binary classification problems?

I saw a post that used the following data: ...
1
vote
0answers
10 views

Elastic net with increased penalty for lower quality features

I’m building multinomial classification models using features characterized with high false-positive rate. Meaning, as the signal rate of the feature is lower (say gene expression abundance) the more ...
4
votes
1answer
95 views

How to find smallest $\lambda$ such all lasso coefficients are set to 0, depending on the intercept?

While bouilding a LASSO-penalized model it is well known that $\lambda =\left\lVert X^ty\right\lVert_\infty$ is the minimum value for which all the $\beta$ coefficients of the model are 0. Consider ...
0
votes
0answers
478 views

Multinomial logistic regression using glmnet

I have a few questions regarding the use of the glmnet package. I have a data with n observation, p variables and k classes. I use the command ...
0
votes
0answers
97 views

Predicting elastic-net values with glmnet after multiple imputation - problem with pooling

I'm having a problem to predict values after I ran elastic net with multiple imputation with MICE. After I run MICE imputation, I have m imputed data sets. I then run an elastic net model on each one ...
1
vote
0answers
88 views

Testing theoretical properties of Multinomial Elastic Net

Consider the multinomial elastic net regression model. As explained in http://statweb.stanford.edu/~jhf/ftp/glmnet.pdf (page 12+13), the penalty term imposes a normalization of the parameter ...
1
vote
1answer
339 views

Elastic Net for Gamma distribution

I am investigating Elastic Net method on R to build a prediction model on pricing amount. I have about 70 dummies variables and results make sense regarding variable selection, stability... However ...
0
votes
0answers
152 views

GLMNET, Mpath Package- Lasso penalty on Poisson and Negative Binomial

I have been trying to analyze a high dimensional data (p exceeds n) with limited observation (n=50). I want to use Lasso method for variable selection and parameter estimation to develop a prediction ...
1
vote
0answers
33 views

Help Interpreting Graph from GLMnet

I am going through the Vignette of R GLMnet package. In the plot section, I am confused about the interpretation the author gave What does he mean by the Lasso performs the best here? How can he say ...