I'm running GridSearchCV on XGBoost model to tune some parameters. My target variable is binary. When I use, 'recall' or 'precision' as scoring metrics in cross validation, I get a single value. I'm not using make_scorer, I'm only passing strings for whichever metric I want to calculate. I'm confused if the recall and precision is for class '0' or class '1'.
So, which precision and recall is for which class?
As you can see in the example image below (not related to my model) from sklearn's classification_report module, both precision and recall can be calculated for individual labels/classes in the target variable.
By default it's calculated for the second class (classes_[1]
). Many utilities and metrics in scikit-learn accept a pos_label
which you can use to control which class is assumed to be the positive class.
For instance, precision_score
has a pos_label
which controls this: documentation
Another example is in PrecisionRecallDisplay
which you can see here.