HammingLossMetric<T>

Models & Types · AiDotNet.Evaluation.Metrics.Classification

Computes Hamming Loss: fraction of labels that are incorrectly predicted.

Implements: IClassificationMetric<T>

For Beginners

Hamming loss is the complement of accuracy (1 - accuracy). It tells you what fraction of your predictions are wrong.

  • Hamming Loss = 0: Perfect predictions (all correct)
  • Hamming Loss = 0.3: 30% of predictions are wrong
  • Hamming Loss = 1: All predictions are wrong

Particularly useful for multi-label classification.

How It Works

Hamming Loss = (1/N) * Σ(prediction ≠ actual)

Constructors

Constructor Summary
HammingLossMetric()

Properties

Property Summary
MetricDirection Direction { get; }
T MaxValue { get; }
T MinValue { get; }
bool RequiresProbabilities { get; }
bool SupportsMultiClass { get; }
string Category { get; }
string Description { get; }
string Name { get; }

Methods

Method Summary
MetricWithCI<T> ComputeWithCI(ReadOnlySpan<T> predictions, ReadOnlySpan<T> actuals, ConfidenceIntervalMethod ciMethod, double confidenceLevel, int bootstrapSamples, int? randomSeed)
T Compute(ReadOnlySpan<T> predictions, ReadOnlySpan<T> actuals)