Submit your inspiring success story or innovative use case to the 2022 Dataiku Frontrunner Awards! ENTER YOUR SUBMISSION

Swap positive and negative classes in confusion matrix.

Solved!
Grégoire_Massot
Swap positive and negative classes in confusion matrix.
Hi team dataiku,

How do you swap the "positive" and the "negative" classes in the confusion matrix of a binary classifier (and get the right Precision and Recall values) ?
0 Kudos
1 Solution
AdrienL
Dataiker
Dataiker

Hello,



By convention, the rarest class is the "positive" class in binary classification.



There is an override for binary-looking values:




  • yes/no

  • true/false

  • 0/1 or 0.0/1.0

  • ok/nok



You can use the Script tab of an Analysis to add preparation steps before training model (e.g. find and replace) so that your target column matches one of those, then re-create a prediction task (or in your existing task's settings, click Learning taks > Redetect settings).

View solution in original post

2 Replies
AdrienL
Dataiker
Dataiker

Hello,



By convention, the rarest class is the "positive" class in binary classification.



There is an override for binary-looking values:




  • yes/no

  • true/false

  • 0/1 or 0.0/1.0

  • ok/nok



You can use the Script tab of an Analysis to add preparation steps before training model (e.g. find and replace) so that your target column matches one of those, then re-create a prediction task (or in your existing task's settings, click Learning taks > Redetect settings).

Grégoire_Massot
Author
I did what you said and changed my 'OK' class with something else to prevent DSS from being fooled.

Thank you !
0 Kudos