-1

How can I print the probability for each class when I am using the soft-voting classifier?

I have tried to print the probability for each class by soft-voting using Python, but I couldn't.

khelwood
  • 55,782
  • 14
  • 81
  • 108
r h
  • 17
  • 4

1 Answers1

0

If you are using scikit-learn you can use predict_proba

pred_proba = eclf.predict_proba(X)

Here eclf is your Voting classifier and will return Weighted average probability for each class per sample.

pred_proba[0] will contain list of probabilities per class for first sample, and pred_proba[1] will contain list of probabilites per class for second sample and so on..

Kartoos
  • 737
  • 1
  • 8
  • 24
  • Here is difference between [predict and predict_proba](https://stackoverflow.com/questions/61184906/difference-between-predict-vs-predict-proba-in-scikit-learn) which might be helpful – Kartoos Oct 26 '22 at 20:30