TimeSeriesSplitter<T>
Models & Types ยท AiDotNet.Preprocessing.DataPreparation.Splitting.TimeSeries
Time series splitter with expanding training window (no shuffling).
Inheritance: DataSplitterBase<T> โ TimeSeriesSplitter<T>
For Beginners
Time series data is ordered by time. Unlike regular data, you CANNOT shuffle it because the order matters - the past predicts the future, not the other way around.
How It Works
How It Works (Expanding Window): Notice: Training window grows, always starting from the beginning.
Critical Rule: Test data MUST always be after training data in time. Never let future data leak into training!
When to Use:
- Stock prices, weather forecasting
- Any data where time order matters
- When you want to simulate real deployment
Constructors
| Constructor | Summary |
|---|---|
TimeSeriesSplitter(int nSplits, int? maxTrainSize, int? testSize, int gap) |
Creates a new time series splitter with expanding window. |
Properties
| Property | Summary |
|---|---|
int NumSplits { get; } |
|
string Description { get; } |
Methods
| Method | Summary |
|---|---|
DataSplitResult<T> Split(Matrix<T> X, Vector<T> y) |
|
IEnumerable<DataSplitResult<T>> GetSplits(Matrix<T> X, Vector<T> y) |