Table of Contents

Class CrossValidationOptions

Namespace
AiDotNet.Models.Options
Assembly
AiDotNet.dll

Represents the configuration options for cross-validation in machine learning models.

public class CrossValidationOptions
Inheritance
CrossValidationOptions
Derived
Inherited Members

Remarks

This class encapsulates various settings that control how cross-validation is performed. It allows users to customize the validation process, including the number of folds, type of validation, data shuffling, and which metrics to compute. These options provide flexibility in how models are evaluated, enabling users to tailor the validation process to their specific needs and dataset characteristics.

For Beginners: This class is like a settings panel for cross-validation.

What it does:

  • Lets you choose how many parts (folds) to split your data into
  • Allows you to pick the type of cross-validation you want to use
  • Gives you the option to shuffle your data randomly
  • Lets you decide which measurements (metrics) to use when evaluating your model

It's like customizing the rules for a series of tests your model will go through, ensuring you get the most useful information about how well your model performs.

Properties

MetricsToCompute

Gets or sets the array of metrics to compute during cross-validation.

public MetricType[] MetricsToCompute { get; set; }

Property Value

MetricType[]

Remarks

These metrics will be calculated for each fold and averaged across all folds. The default metrics are R-squared (R2), Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE). You can customize this array to include any metrics relevant to your specific problem.

NumberOfFolds

Gets or sets the number of folds to use in cross-validation.

public int NumberOfFolds { get; set; }

Property Value

int

Remarks

This determines how many parts the data will be split into. The default is 5 folds. A higher number of folds generally provides a more thorough evaluation but takes longer to compute.

RandomSeed

Gets or sets the random seed for data shuffling.

public int? RandomSeed { get; set; }

Property Value

int?

Remarks

If set, this ensures reproducibility of random operations. If null, a random seed will be used. Setting a specific seed allows you to get the same results across multiple runs.

ShuffleData

Gets or sets whether to shuffle the data before splitting into folds.

public bool ShuffleData { get; set; }

Property Value

bool

Remarks

Shuffling helps ensure that the order of the data doesn't affect the validation results. It's generally recommended to keep this true unless you have a specific reason not to shuffle.

ValidationType

Gets or sets the type of cross-validation to perform.

public CrossValidationType ValidationType { get; set; }

Property Value

CrossValidationType

Remarks

This specifies the strategy for splitting the data. The default is K-Fold cross-validation. Different types are suitable for different kinds of data or evaluation needs.