FowlkesMallowsIndex<T>

Models & Types ยท AiDotNet.Clustering.Evaluation

Computes the Fowlkes-Mallows Index for cluster-label agreement.

Implements: IClusterMetric<T>, IExternalClusterMetric<T>

For Beginners

The FM Index measures agreement between clusterings.

For every pair of points, ask two questions:

  1. Are they in the same true class?
  2. Are they in the same predicted cluster?

Possible outcomes:

  • TP: Both same class AND same cluster (correct!)
  • TN: Both different class AND different cluster (correct!)
  • FP: Different class but same cluster (wrong!)
  • FN: Same class but different cluster (wrong!)

FM Index = sqrt(Precision * Recall)

  • Precision: Of pairs we grouped together, how many should be?
  • Recall: Of pairs that should be together, how many did we group?

Range: 0 (no agreement) to 1 (perfect agreement) Random clustering: FM โ‰ˆ sqrt(1/K) where K is number of clusters

How It Works

The Fowlkes-Mallows Index (FMI) is the geometric mean of precision and recall for pairs of points. It measures similarity between two clusterings and requires ground truth labels.

Formula: FM = sqrt(TP / (TP + FP) * TP / (TP + FN)) where:

  • TP = pairs correctly put in same cluster
  • FP = pairs incorrectly put in same cluster
  • FN = pairs incorrectly put in different clusters

Constructors

Constructor Summary
FowlkesMallowsIndex()

Properties

Property Summary
bool HigherIsBetter { get; }
string Name { get; }

Methods

Method Summary
double Compute(Matrix<T> data, Vector<T> labels)
double ComputeWithTrueLabels(Matrix<T> data, Vector<T> predictedLabels, Vector<T> trueLabels) Computes FM Index comparing predicted labels to true labels.