For a simple binary classification problem, I would like to find what threshold setting maximizes the f1 score, which is the harmonic mean of precision and recall. Is there any built-in in scikit learn that does this? Right now, I am simply calling
precision, recall, thresholds = precision_recall_curve(y_test, y_test_predicted_probas) And then, I can compute the f1 score using the information at each index in the triplet of arrays:
curr_f1 = compute_f1(precision[index], recall[index]) Is there a better way of doing this, or is this how the library was intended to be used? Thanks.