Stack Exchange Network

Stack Exchange network consists of 175 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
21 views

Is adaptive lasso still unbiased for glm(such as Logistics)?

I'm doing something about penalized Logistics regression with adaptive LASSO recently. But I found that the coefficients from Logisitcs+adaptive LASSO is quite different from the normal Logistics ...
0
votes
0answers
8 views

Do I need to do glmnet after doing a cv.glmnet?

I'm studying now about the model selection from the ISLR book. I'm don't understand about whether should I do glmnet() after I do ...
1
vote
1answer
26 views

glmnet package: “mgaussian” vs “gaussian” for $\alpha = 0$

In multiresponse Gaussian family the objective function when $\alpha = 0$: \begin{align} \frac{1}{2n}||Y-XB||_F^2 + \frac{\lambda}{2}||B||_F^2. \end{align} This can also mathematically solved as \...
0
votes
0answers
44 views

Tuning glmnet hyperparameters in MLR

I want to estimate LASSO using glmnet in MLR with spatial cross-validation to tune lambda. Questions: In makeParamSet, do I specify ...
0
votes
1answer
71 views

Clarification for LASSO based Cox model using glmnet

I am trying to find a variable signature associated with a characteristic. Particularly I am looking to get a prognostic model from multi-variable data for gene expression. I have the "Time (survival ...
0
votes
0answers
13 views

Choosing prediction model with regularization, spatial cross-validation and bounded predictions

I am new to machine learning and R. I want to run a statistical model to predict daily hours of supply of electricity (y). I have several x variables to use for prediction. I have three goals to ...
3
votes
0answers
62 views

Why does cv.glmnet not use the same lambda sequence across different folds to find the hypertuning parameter lambda?

I assumed that cv.glmnet works as follows: Generate multiple glmnet fits for the entire data, presumably for automated lambda sequence using coordinate descent Use the lambdas gotten in step 1, and ...
0
votes
1answer
39 views

Interpreting glmnet cox coefficients

There have been similar questions regarding interpretation of glmnet results. However this is more specific to the cox part of the package. I am trying to create a prognostic score for cancer ...
0
votes
1answer
50 views

Lasso cox regression with bootstrap

I'm looking at building a nomogram for cancer prognosis based on 20 variables. This will be derived from a cox ph model. In the past I used poor methodology including dichotomization and stepwise ...
0
votes
1answer
36 views

COX model with Lasso using one dataset and predicting in a different dataset

I am very new to R. I am performing Cox model with LASSO variable selection in one group. I am using the coefficients of the selected variables and apply to another dataset. My goal is to produce ...
0
votes
0answers
10 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
31 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
78 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
25 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
86 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
18 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
64 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
19 views

Ridge analytically vs glmnet [duplicate]

With an outcome variable and two correlated regressors... ...
0
votes
0answers
37 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
13 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
369 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
141 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
34 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 ...
-1
votes
1answer
178 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
444 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
93 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
110 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
215 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
234 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
230 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
475 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
116 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
42 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
200 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 ...
-1
votes
0answers
49 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
32 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
70 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
94 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
79 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
553 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
45 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
219 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
259 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
78 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
422 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: ...
3
votes
1answer
3k views

Is the LASSO really applicable for binary classification problems?

I saw a post that used the following data: ...
1
vote
0answers
15 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
105 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
601 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 ...