TimeSeriesCrossValidator<T, TInput, TOutput>

Models & Types · AiDotNet.CrossValidators

Implements a time series cross-validation strategy for model evaluation.

Inheritance: CrossValidatorBase<T, TInput, TOutput> → TimeSeriesCrossValidator<T, TInput, TOutput>

For Beginners

Time series cross-validation is designed for data that has a time component.

What this class does:

  • Starts with a small portion of your data for training
  • Uses the next part for validation
  • Expands the training set to include the previous validation set
  • Repeats this process, moving forward in time
  • Calculates how well your model performs on average across all these tests

This is useful because:

  • It respects the time order of your data
  • It simulates how the model would perform in a real-world scenario where you use past data to predict the future
  • It helps detect if your model’s performance changes over time

How It Works

This class provides a time series cross-validation implementation, which respects the temporal order of the data. It uses an expanding window approach, where the training set grows over time.

Constructors

Constructor Summary
TimeSeriesCrossValidator(int initialTrainSize, int validationSize, int step, CrossValidationOptions options) Initializes a new instance of the TimeSeriesCrossValidator class.

Methods

Method Summary
CrossValidationResult<T, TInput, TOutput> Validate(IFullModel<T, TInput, TOutput> model, TInput X, TOutput y, IOptimizer<T, TInput, TOutput> optimizer) Performs the time series cross-validation process on the given model using the provided data and optimizer.