AccuracyMetric<T>

Models & Types · AiDotNet.Evaluation.Metrics.Classification

Computes classification accuracy: the proportion of correct predictions.

Implements: IClassificationMetric<T>

For Beginners

Accuracy is the simplest classification metric - what percentage of predictions were correct? An accuracy of 0.9 means 90% of predictions were right.

How It Works

Accuracy = (TP + TN) / (TP + TN + FP + FN) = Correct / Total

Limitations: Accuracy can be misleading for imbalanced datasets. If 95% of samples are class A, a model that always predicts A achieves 95% accuracy but is useless. Use balanced accuracy, F1-score, or other metrics for imbalanced data.

Constructors

Constructor Summary
AccuracyMetric()

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)