title: How to apply lasso logistic regression with caret and glmnet?
body: <p>I am trying to repeat the following lines of code:</p>
  
  <pre><code>x.mat &lt;- as.matrix(train.df[,predictors])
  y.class &lt;- train.df$Response
  
  cv.lasso.fit &lt;- cv.glmnet(x = x.mat, y = y.class, 
                            family = "binomial", alpha = 1, nfolds = 10)
  </code></pre>
  
  <p>... with the caret package, but it doesn't work:</p>
  
  <pre><code>trainControl &lt;- trainControl(method = "cv",
                         number = 10,
                         # Compute Recall, Precision, F-Measure
                         summaryFunction = prSummary,
                         # prSummary needs calculated class probs
                         classProbs = T)
  
  modelFit &lt;- train(Response ~ . -Id, data = train.df, 
              method = "glmnet", 
              trControl = trainControl,
              metric = "F", # Optimize by F-measure
              alpha=1,
              family="binomial")
  </code></pre>
  
  <p>The parameter "alpha" is not recognized, and "the model fit fails in every fold".</p>
  
  <p>What am I doing wrong? Help would be much appreciated. Thanks.</p>