AdjustedR2Metric<T>

Models & Types · AiDotNet.Evaluation.Metrics.Regression

Computes Adjusted R² Score: R² adjusted for the number of predictors in the model.

Implements: IRegressionMetric<T>

For Beginners

Adjusted R² penalizes adding unnecessary predictors to a model. Unlike regular R² which always increases (or stays the same) when adding features, adjusted R² will decrease if the new feature doesn’t improve the model enough.

  • Use when comparing models with different numbers of features
  • Lower than R² when predictors don’t contribute meaningfully
  • Can be negative if the model performs very poorly

How It Works

Adjusted R² = 1 - (1 - R²) * (n - 1) / (n - p - 1)

Constructors

Constructor Summary
AdjustedR2Metric(int numPredictors) Initializes the Adjusted R² metric.

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)