Closed jianqin123 closed 7 years ago
I think that if you are doing a classification your target variable must be a factor, in this case a two level factor variable. See the error message.
if change into factor ,how can I get a gression model , that is what I want ;thank you!
I do not understand. In your previous post you said that you are trying to build a binary classifier, but now you say that you want a regression model.
Sorry about that, I mean a gression model gives the probility of positive class ,which is also a binary classfier.That's what I want.
I see. Perhaps the caret
internals won't let you do that. Have you tried using gbm
directly?
You don't need to pass the distribution
argument. You can, but in the case where the outcome is a binary factor, it does it for you.
To be honest, you can optimize the model with RMSE but it is a pretty bad objective function for classification.
If you really want to do this, I suggest:
as.numeric()-1
trick in your original code to get the outcome back to 0/1. classProbs = TRUE
to the trainControl
call if you are going to use the predicted class probabilities in the RMSE calculation. thanks a lot!
I'll close this but re-open it if you need to.
I'm trying to create a binary classifier, modelling with caret to optimize RMSE. The method I was attempting was gbm .I use the data in packages e1071,and try to train a regression model with gbm.the follow is my code.
this is error information :
I asked this question on stackoverflow,[(http://stackoverflow.com/questions/41501369/error-in-train-default-stopping) ,and there is some simliar question on stackoverflow and this website, but it doesn't work,
if I change the response varable (type )to factor,it works,but it is a classification model,that's not I want. thank you in advance!