sklearn.metrics.jaccard_similarity_score

Warning

DEPRECATED

sklearn.metrics.jaccard_similarity_score(y_true, y_pred, normalize=True, sample_weight=None)[source]

Jaccard similarity coefficient score

Deprecated since version 0.21: This is deprecated to be removed in 0.23, since its handling of binary and multiclass inputs was broken. jaccard_score has an API that is consistent with precision_score, f_score, etc.

Read more in the User Guide.

Parameters
y_true1d array-like, or label indicator array / sparse matrix

Ground truth (correct) labels.

y_pred1d array-like, or label indicator array / sparse matrix

Predicted labels, as returned by a classifier.

normalizebool, optional (default=True)

If False, return the sum of the Jaccard similarity coefficient over the sample set. Otherwise, return the average of Jaccard similarity coefficient.

sample_weightarray-like of shape (n_samples,), default=None

Sample weights.

Returns
scorefloat

If normalize == True, return the average Jaccard similarity coefficient, else it returns the sum of the Jaccard similarity coefficient over the sample set.

The best performance is 1 with normalize == True and the number of samples with normalize == False.

Notes

In binary and multiclass classification, this function is equivalent to the accuracy_score. It differs in the multilabel classification problem.

References

1

Wikipedia entry for the Jaccard index