PredictionStats<T>

Models & Types · AiDotNet.Statistics

Calculates and stores various statistics to evaluate prediction performance and generate prediction intervals.

How It Works

This class provides a comprehensive set of metrics to evaluate predictive models and calculate different types of statistical intervals around predictions.

For Beginners: When you build a predictive model (like a machine learning model), you often want to:

  1. Measure how well your model performs (using metrics like R-squared (R2), accuracy, etc.)
  2. Understand how confident you can be in your predictions (using various intervals)
  3. Understand the relationship between actual and predicted values (using correlations)

This class helps you do all of these things. The “T” in PredictionStats means it works with different number types like decimal, double, or float without needing separate implementations for each.

Properties

Property Summary
DistributionFitResult<T> BestDistributionFit { get; set; }
List<T> LearningCurve { get; set; }
List<ValueTuple<T, T, T>> QuantileIntervals { get; set; }
T Accuracy { get; set; }
T AdjustedR2 { get; set; } R² adjusted for the number of predictors in the model.
T DynamicTimeWarping { get; set; }
T ExplainedVarianceScore { get; set; }
T F1Score { get; set; }
T KendallTau { get; set; }
T MeanPredictionError { get; set; }
T MedianPredictionError { get; set; }
T PearsonCorrelation { get; set; }
T Precision { get; set; }
T PredictionIntervalCoverage { get; set; }
T R2 { get; set; } Coefficient of determination - The proportion of variance in the dependent variable explained by the model.
T RSquared { get; } R-Squared - Alias for R2 property (Coefficient of determination).
T Recall { get; set; }
T SpearmanCorrelation { get; set; }
ValueTuple<T, T> BootstrapInterval { get; set; }
ValueTuple<T, T> ConfidenceInterval { get; set; }
ValueTuple<T, T> CredibleInterval { get; set; }
ValueTuple<T, T> ForecastInterval { get; set; }
ValueTuple<T, T> JackknifeInterval { get; set; }
ValueTuple<T, T> PercentileInterval { get; set; }
ValueTuple<T, T> PredictionInterval { get; set; }
ValueTuple<T, T> SimultaneousPredictionInterval { get; set; }
ValueTuple<T, T> ToleranceInterval { get; set; }

Methods

Method Summary
PredictionStats<T> Empty() Creates an empty PredictionStats instance with all metrics set to zero.
PredictionStats<T> WithR2Only(T r2) Creates a lightweight PredictionStats with only the R² coefficient populated.
T GetMetric(MetricType metricType) Retrieves a specific metric value by metric type.
bool HasMetric(MetricType metricType) Checks if a specific metric is available in this PredictionStats instance.