If i do a modelLookup('glmnet') it says TRUE for probModel (and in fact, I'd expect it to be usable as a model to predict probabilities in a binary outcome prediction problem as glmnet has a 'binomial' family argument).
However, following the instructions from the caret package I say:
trainControl = trainControl(classProbs=TRUE)
modelFit = train(X, y, method='glmnet', trControl=trainControl)
and I get:
cannot compute class probabilities for regression
Am I doing something wrong?
Best Answer
I suspect your
y
is of classnumeric
and is not an Rfactor
. You can look at the documentation forglmnet
directly,(emphasize is mine.)
or check it with the following toy example: