Compute the jaccard_score metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute jaccard_score, or asks how to score with jaccard_score.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add qhjqhj00/research-skills-pool --skill jaccard-score --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Jaccard Score?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-jaccard-score)More formats (shields.io, HTML) on the badges page.
---
name: jaccard-score
description: Compute the jaccard_score metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute jaccard_score, or asks how to score with jaccard_score.
metadata:
skill_kind: metric
source_lib: scikit-learn
import_path: sklearn.metrics.jaccard_score
source: library_introspection
---
# jaccard-score
> Metric `jaccard_score` from `scikit-learn` (sklearn.metrics.jaccard_score)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with jaccard_score, or
mentions `sklearn.metrics.jaccard_score` directly, or wants the standard scikit-learn implementation.
## Reference signature
```python
from sklearn.metrics import jaccard_score
# jaccard_score(y_true, y_pred, *, labels=None, pos_label=1, average='binary', sample_weight=None, zero_division='warn')
```
## Library docstring
```
Jaccard similarity coefficient score.
The Jaccard index [1], or Jaccard similarity coefficient, defined as
the size of the intersection divided by the size of the union of two label
sets, is used to compare set of predicted labels for a sample to the
corresponding set of labels in ``y_true``.
Support beyond :term:`binary` targets is achieved by treating :term:`multiclass`
and :term:`multilabel` data as a collection of binary problems, one for each
label. For the :term:`binary` case, setting `average='binary'` will return the
Jaccard similarity coefficient for `pos_label`. If `average` is not `'binary'`,
`pos_label` is ignored and scores for both classes are computed, then averaged or
both returned (when `average=None`). Similarly, for :term:`multiclass` and
:term:`multilabel` targets, scores for all `labels` are either returned or
averaged depending on the `average` parameter. Use `labels` specify the set of
labels to calculate the score for.
Read more in the :ref:`User Guide <jaccard_similarity_score>`.
Parameters
----------
y_true : 1d array-like, or label indicator array / sparse matrix
Ground truth (correct) labels. Sparse matrix is only supported when
labels are of :term:`multilabel` type.
y_pred : 1d array-like, or label indicator array / sparse matrix
Predicted labels, as returned by a classifier. Sparse matrix is only
supported when labels are of :term:`multilabel` type.
labels : array-like of shape (n_classes,), default=None
The set of labels to include when `average != 'binary'`, and their
order if `average is None`. Labels present in the data can be
excluded, for example in multiclass classification to exclude a "negative
class". Labels not present in the data can be included and will be
"assigned" 0 samples. For multilabel targets, labels are column indices.
By default, all labels in `y_true` and `y_pred` are used in sorted order.
pos_label : int, float, bool or str, default=1
The class to report if `average='binary'` and the data is binary,
otherwise this parameter is ignored.
For multiclass or multilabel targets, set `labels=[pos_label]` and
`average != 'binary'` to report metrics for o
```
## Quick recipe
```python
import sklearn.metrics as _m
score = _m.jaccard_score(y_true, y_pred)
```
## Don'ts
- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!