Measure the similarity of two clusterings of a set of points.
Added in version 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 User Guide.
A clustering of the data into disjoint subsets.
A clustering of the data into disjoint subsets.
Compute contingency matrix internally with sparse matrix.
Deprecated since version 1.7: The sparse
parameter is deprecated and will be removed in 1.9. It has no effect.
The resulting Fowlkes-Mallows score.
References
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_mallows_score([0, 0, 0, 0], [0, 1, 2, 3]) 0.0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4