VMeasure<T>

Models & Types · AiDotNet.Clustering.Evaluation

Computes the V-Measure for cluster-label agreement.

Implements: IClusterMetric<T>, IExternalClusterMetric<T>

For Beginners

V-Measure combines two important properties:

Homogeneity: “Is each cluster pure?”

  • A cluster is pure if it contains only one type of item
  • Example: A “cats” cluster should have only cats

Completeness: “Is each class together?”

  • All items of the same type should be in the same cluster
  • Example: All cats should be in the same cluster

V-Measure balances these:

  • High homogeneity + low completeness = many small pure clusters
  • Low homogeneity + high completeness = one big impure cluster
  • High V-Measure = both are high (ideal)

V-Measure ranges from 0 to 1, where 1 is perfect agreement.

How It Works

V-Measure is the harmonic mean of homogeneity and completeness, providing a single metric that balances both properties. It requires ground truth labels.

Components:

  • Homogeneity: Each cluster contains only members of a single class
  • Completeness: All members of a given class are assigned to the same cluster
  • V-Measure: 2 * (homogeneity * completeness) / (homogeneity + completeness)

Constructors

Constructor Summary
VMeasure(double beta) Initializes a new VMeasure instance.

Properties

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

Methods

Method Summary
double Compute(Matrix<T> data, Vector<T> labels)
double ComputeCompleteness(Vector<T> predictedLabels, Vector<T> trueLabels) Computes completeness score.
double ComputeHomogeneity(Vector<T> predictedLabels, Vector<T> trueLabels) Computes homogeneity score.
double ComputeWithTrueLabels(Matrix<T> data, Vector<T> predictedLabels, Vector<T> trueLabels) Computes V-Measure comparing predicted labels to true labels.