ValidationHelper<T>
Helpers & Utilities · AiDotNet.Helpers
Provides validation methods for AI model inputs and parameters.
How It Works
For Beginners: This helper class ensures that the data you provide to AI models is valid and properly formatted. It can handle both traditional matrix/vector inputs (for regression-like models) and tensor inputs (for neural networks). Think of it as a quality control checkpoint that prevents errors before they happen by checking that your data meets all the requirements needed for successful model training and prediction.
Methods
| Method | Summary |
|---|---|
ValueTuple<TargetKind<T>, List<T>> ClassifyTarget(Vector<T> y) |
Classifies a target vector as binary, multiclass, continuous, or single-class. |
ValueTuple<Vector<T>, List<T>> EncodeBinaryTarget(Vector<T> y, string modelName) |
Validates a binary classification target and encodes it to the canonical 0/1 form. |
ValueTuple<Vector<T>, List<T>> EncodeMulticlassTarget(Vector<T> y, string modelName) |
Validates a multiclass target and encodes it to consecutive indices 0..K-1. |
ValueTuple<string, string> GetCallerInfo(int skipFrames) |
Gets information about the calling method. |
ValueTuple<string, string> ResolveCallerInfo(string component, string operation, int skipFrames) |
Resolves component and operation names, using caller info if either is empty. |
Vector<T> ValidateProportionTarget(Vector<T> y, string modelName, bool allowBoundaryCompression) |
Validates a proportion target for Beta regression, optionally compressing exact 0 and 1 into the open interval. |
string DescribeTarget(Vector<T> y) |
Summarizes a target vector for an error message: how many distinct values it holds and its range. |
void ValidateInputData(OptimizationInputData<T, TInput, TOutput> inputData) |
Validates that optimization input data is properly formatted for model training and evaluation. |
void ValidateInputData(TInput x, TOutput y) |
Validates that input data is properly formatted for model training. |
void ValidatePoissonData(Vector<T> y) |
Validates that data is appropriate for Poisson regression. |