You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
The text was updated successfully, but these errors were encountered:
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.
Keras provides a metric of
precision
andrecall
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
:If I understand correctly,
precision
will count each element as a single label. In other words, ify_true
andy_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 ?The text was updated successfully, but these errors were encountered: