-1
$\begingroup$

I have a Multiclass Dataset and I am getting probabilities of classes from RandomForest.

However, I want to divide the dataset for each class as examples of either the case belongs to that class or not(Binary Classification). I want to know , when I get the prediction of those models for a yes or no.

How can I ensemble them in such a way that Overall Sum of probabilities as one?

$\endgroup$

1 Answer 1

3
$\begingroup$

I think it can be done by using this command at the time of prediction, giving example in R

#To predict with probabilities
testSet$pred_rf_prob<-`predict(object,model_rf,testSet[,predictors],type='prob')`

To take average of the predictions:

testSet$pred_avg<-(testSet$pred_rf_prob$Y+testSet$pred_knn_prob$Y+testSet$pred_lr_prob$Y)/3

This Link , might be helpful. Do have a look.

Let me know if you have any additional questions.

$\endgroup$
5
  • $\begingroup$ Don't know about R. Working in python. Can you help me in that? $\endgroup$ Nov 18, 2017 at 10:59
  • 1
    $\begingroup$ sure will have a look and update you in sometime. $\endgroup$
    – Toros91
    Nov 18, 2017 at 11:00
  • 1
    $\begingroup$ Do go through this Link, here you have something called as Probability, clf3 = SVC(kernel='rbf', probability=True). I think that might work, have a look but i'm not sure. $\endgroup$
    – Toros91
    Nov 18, 2017 at 11:12
  • 1
    $\begingroup$ @Toros91 It seems to me you are missing the essential part of OP's question which relates to handling probabilities out of a series of 1-vs-1 models defined from an original 1-vs-all problem setting. $\endgroup$
    – tagoma
    Nov 18, 2017 at 14:56
  • 1
    $\begingroup$ yes, i understood that part, try giving Probabilities to False and see how it works. $\endgroup$
    – Toros91
    Nov 18, 2017 at 15:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.