Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understanding of Metric for Precision and Recall for Multi-label Classification #5705

Closed
pengpaiSH opened this issue Mar 11, 2017 · 2 comments

Comments

@pengpaiSH
Copy link

Keras provides a metric of precision and recall for multi-label classification. The document says that "Calculates the precision, a metric for multi-label classification of how many selected items are relevant." And the source code in /keras/metrics.py:

def precision(y_true, y_pred):
    """Precision metric.
    Only computes a batch-wise average of precision.
    Computes the precision, a metric for multi-label classification of
    how many selected items are relevant.
    """
    true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
    predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1)))
    precision = true_positives / (predicted_positives + K.epsilon())
    return precision

If I understand correctly, precision will count each element as a single label. In other words, if y_true and y_pred are 2D arrays, e.g. with shape (32, 13) if the batch size is 32 and the number of classes is 13. What if I only care about class-level precision? For example, if I would like to know the 1st class precision, 2nd class precision ... etc ?

@callicles
Copy link

Hi,

Those metrics have been removed in 2.0. #5794

@stale
Copy link

stale bot commented Aug 2, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

@stale stale bot closed this as completed Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants