Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[MRG+2] ENH&BUG Add pos_label parameter and fix a bug in average_precision_score #9980
part of #9829
What does this implement/fix? Explain your changes.
(1)add pos_label parameter to average_precision_score (Although we finally decide not to introduce pos_label in roc_auc_score, I think we might need pos_label here. Because there are no relationship between the results if we reverse the true labels, also, precision/recall all support pos_label)
y_true = np.array([0, 0, 0, 1, 1, 1]) y_score = np.array([0.1, 0.4, 0.85, 0.35, 0.8, 0.9]) average_precision_score(y_true, y_score, sample_weight=[1, 1, 0, 1, 1, 0]) # output:nan
I do it here because of (3)
Any other comments?
cc @jnothman Could you please take some time to review or at least judge whether this is the right way to go? Thanks a lot :)
@jnothman Thanks a lot for the review :) Comments addressed. I also simplify the code.
At this point not. But we do the check once we finish the preparation and enter
@jnothman Thanks for the review :) I update what's new (not sure whether we need two entries)
I'm not creating term but just reverting the previous change (#9557) since we now extend the function. We are using the term