SpearmanCorrelationMetric<T>

Models & Types · AiDotNet.Evaluation.Metrics.Regression

Computes Spearman’s Rank Correlation Coefficient between predictions and actuals.

Implements: IRegressionMetric<T>

For Beginners

Spearman correlation measures monotonic relationships:

  • Range: -1 to 1
  • 1 = perfect positive monotonic relationship
  • -1 = perfect negative monotonic relationship
  • Non-parametric (uses ranks, not values)
  • Robust to outliers unlike Pearson correlation

How It Works

ρ = 1 - 6Σd²/(n(n²-1)) where d = rank difference

Constructors

Constructor Summary
SpearmanCorrelationMetric()

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)