-1

The output of the classifier is basically 1 and 0 depending on the transformed label, right? But how do I print out its calculation result? Rather than,

Predicted: 1

1 means High, 0 means Low

I wanted to have the output

Predicted: 86.4% Low

How to print its percentage?

Messy Maze
  • 3
  • 1
  • 2

1 Answers1

0

Try using the model's method: predict_proba(X)

This function will return you the probability of the samples for each class in the model. For example, if you have a binary classification problem, your output will be something like:

[0.22 , 0.78]

Meaning that the sample you tested is 22% possible to be class 0, and 78% to be class 1. So, you are obtaining the percentages of belonging each class.

Alex Serra Marrugat
  • 1,849
  • 1
  • 4
  • 14