I am trying to fit a logistic regression model in R using the caret package
. I have done the following:
model <- train(dec_var ~., data=vars, method="glm", family="binomial",
trControl = ctrl, tuneGrid=expand.grid(C=c(0.001, 0.01, 0.1, 1,10,100, 1000)))
However, I am unsure what the tuning parameter should be for this model and I am having a difficult time finding it. I assumed it is C because C is the parameter used in sklearn
. Currently, I am getting the following error -
Error: The tuning parameter grid should have columns parameter
Do you have any suggestions on how to fix this?
Per Max Kuhn's web-book - search for
method = 'glm'
here ,there is no tuning parameterglm
withincaret
.We can easily verify this is the case by testing out a few basic
train
calls. First off, let's start with a method (rpart
) that does have a tuning parameter (cp
) per the web book.We see that the
cp
parameter was tuned. Now let's tryglm
.In this case with
glm
above there was no parameter tuning performed. From my experience, it appears theparameter
namedparameter
is just a placeholder and not a real tuning parameter. As demonstrated in the code that follows, even if we try to force it to tuneparameter
it basically only does a single value.