Compute the fowlkes_mallows_score metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute fowlkes_mallows_score, or asks how to score with fowlkes_mallows_score.
Scanned 9/11/2026
Install to Claude Code
npx -y skills add qhjqhj00/research-skills-pool --skill fowlkes-mallows-score --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Fowlkes Mallows Score?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/qhjqhj00-fowlkes-mallows-score)More formats (shields.io, HTML) on the badges page.
---
name: fowlkes-mallows-score
description: Compute the fowlkes_mallows_score metric — provided by scikit-learn. Use when the user has predictions and ground-truth and needs to compute fowlkes_mallows_score, or asks how to score with fowlkes_mallows_score.
metadata:
skill_kind: metric
source_lib: scikit-learn
import_path: sklearn.metrics.fowlkes_mallows_score
source: library_introspection
---
# fowlkes-mallows-score
> Metric `fowlkes_mallows_score` from `scikit-learn` (sklearn.metrics.fowlkes_mallows_score)
## When to invoke this skill
The user has predictions + ground truth and asks to evaluate with fowlkes_mallows_score, or
mentions `sklearn.metrics.fowlkes_mallows_score` directly, or wants the standard scikit-learn implementation.
## Reference signature
```python
from sklearn.metrics import fowlkes_mallows_score
# fowlkes_mallows_score(labels_true, labels_pred, *, sparse='deprecated')
```
## Library docstring
```
Measure the similarity of two clusterings of a set of points.
.. versionadded:: 0.18
The Fowlkes-Mallows index (FMI) is defined as the geometric mean of
the precision and recall::
FMI = TP / sqrt((TP + FP) * (TP + FN))
Where ``TP`` is the number of **True Positive** (i.e. the number of pairs of
points that belong to the same cluster in both ``labels_true`` and
``labels_pred``), ``FP`` is the number of **False Positive** (i.e. the
number of pairs of points that belong to the same cluster in
``labels_pred`` but not in ``labels_true``) and ``FN`` is the number of
**False Negative** (i.e. the number of pairs of points that belong to the
same cluster in ``labels_true`` but not in ``labels_pred``).
The score ranges from 0 to 1. A high value indicates a good similarity
between two clusters.
Read more in the :ref:`User Guide <fowlkes_mallows_scores>`.
Parameters
----------
labels_true : array-like of shape (n_samples,), dtype=int
A clustering of the data into disjoint subsets.
labels_pred : array-like of shape (n_samples,), dtype=int
A clustering of the data into disjoint subsets.
sparse : bool, default=False
Compute contingency matrix internally with sparse matrix.
.. deprecated:: 1.7
The ``sparse`` parameter is deprecated and will be removed in 1.9. It has
no effect.
Returns
-------
score : float
The resulting Fowlkes-Mallows score.
References
----------
.. [1] `E. B. Fowkles and C. L. Mallows, 1983. "A method for comparing two
hierarchical clusterings". Journal of the American Statistical
Association
<https://www.tandfonline.com/doi/abs/10.1080/01621459.1983.10478008>`_
.. [2] `Wikipedia entry for the Fowlkes-Mallows Index
<https://en.wikipedia.org/wiki/Fowlkes-Mallows_index>`_
Examples
--------
Perfect labelings are both homogeneous and complete, hence have
score 1.0::
>>> from sklearn.metrics.cluster import fowlkes_mallows_score
>>> fowlkes_mallows_score([0, 0, 1, 1], [0, 0, 1, 1])
1.0
>>> fowlkes_mallows_score([0, 0, 1, 1], [1, 1, 0, 0])
1.0
If classes members are completely split across different clusters,
the assignment is totally random, hence the FMI is null::
>>> fowlkes_mall
```
## Quick recipe
```python
import sklearn.metrics as _m
score = _m.fowlkes_mallows_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!