0
$\begingroup$

I have a dataframe of 39,600 records and 13 columns (12 of which are the predictors. 3 of the 12 are factor variables, the rest are numeric). The response variable Class has 2 outcomes ('Normal' and 'Malicious').

I tuned a ridge logistic regression as follows

library(glmnet) 
library(caret)

lambdas <- 10^seq(-3,3,length=100)

ridge_log_mod <- train(Class ~., 
                        data = df, 
                        method = "glmnet", 
                        preProcess = c("center", "scale"),
                        trControl = trainControl("repeatedcv",
                                               number=10,
                                               repeats=3),
                        tuneGrid = expand.grid(alpha=0, 
                                               lambda=lambdas)
)

However, when I examined the ridge_log_mod, it showed there were 13 variables (instead of 12) for the Pre-processing step as shown below

> ridge_log_mod
glmnet 

39600 samples
   12 predictor
    2 classes: 'Normal', 'Malicious' 

Pre-processing: centered (13), scaled (13)
Resampling: Cross-Validated (10 fold, repeated 3 times) 
Summary of sample sizes: 35640, 35640, 35640, 35640, 35640, 35640, ... 
Resampling results across tuning parameters:

  lambda        Accuracy   Kappa    
  1.000000e-03  0.9890320  0.9780640
  1.149757e-03  0.9890320  0.9780640
  1.321941e-03  0.9890320  0.9780640
  1.519911e-03  0.9890320  0.9780640
...

I simply couldn't understand where that number 13 came from. Did it mean the train(.) function also scaled the response variable Class? How did the function train(.) scale the 3 categorical variables? Did I do something wrong?

$\endgroup$
1
  • 1
    $\begingroup$ Could this be the intercept of the model? $\endgroup$
    – Oxbowerce
    May 11 at 18:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.