[Python] How to extract auc scores from scikitplot plot_precision_recall method?

Discussão em 'Python' iniciado por Stack, Fevereiro 6, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to get the micro-average score as displayed in:

    from scikitplot.metrics import plot_precision_recall

    plot_precision_recall(np.array(y_test), y_pred_proba)
    plt.show()


    For example, I have the plot:

    [​IMG]

    with micro-average of 0.975

    I've tried using the auc method with precision_recall_curve and average_precision_score among other methods, but the results are not the same. If I could just extract the desired auc score from the plot_precision_recall method itself, that would be easiest.

    I believe the issue is that, as per the documentation, use of the average='micro' argument "Will be ignored when y_true is binary" and thus the macro average is being reported, at least for roc_auc_score. For average_precision_score it's reporting only the PR AUC for the positive class.

    NB: I am not including a reproducible example because I only want to get the respective scores from the plot_precision_recall method.

    I've Googled up a storm with negative results.

    Continue reading...

Compartilhe esta Página