BlockedTimeSeriesSplitter<T>
Models & Types · AiDotNet.Preprocessing.DataPreparation.Splitting.TimeSeries
Time series splitter with a gap (purge) between training and test sets.
Inheritance: DataSplitterBase<T> → BlockedTimeSeriesSplitter<T>
For Beginners
In time series, data points close together are often correlated. If your training data is right next to your test data, some information might “leak” from the test period into training.
How It Works
The Gap Solution: Adding a gap (also called “purge”) between train and test ensures no leakage:
The gap samples are neither trained on nor tested - they’re a buffer zone.
When to Use:
- When features depend on recent past values (rolling averages, momentum)
- Financial time series with overlapping windows
- When data points are auto-correlated
Constructors
| Constructor | Summary |
|---|---|
BlockedTimeSeriesSplitter(int nSplits, int gap) |
Creates a new blocked time series splitter. |
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) |