Overview
Dataset class compatible with TimesFM (Time Series Foundation Model) for time series forecasting.Class signature
Parameters
Dataset name used to locate data.
Datetime column name in the CSV.
Path to CSV file. If None, loader from
BaseDataset will be used.Batch size for dataloaders.
Mode of use:
"train" or "test".Train/val/test split boundaries. Default splits as: 50% train, 20% val, 30% test.
Historical context length.
Forecast horizon length.
Data frequency code (e.g.,
"h" for hourly, "d" for daily, "m" for monthly).Whether to normalize input features.
Stride used when creating windows from the timeseries.
Extra backend-specific options.
Methods
get_data_loader()
Get a DataLoader for the dataset.
DataLoader - DataLoader for the dataset.
preprocess_train_batch(data)
Preprocess a training batch.
data(tuple): Input data tuple.
dict - Preprocessed data dictionary with keys 'input_ts' and 'actual_ts'.
preprocess_eval_batch(data)
Preprocess an evaluation batch.
data(tuple): Input data tuple.
dict - Preprocessed data dictionary with keys 'input_ts' and 'actual_ts'.
preprocess(data)
Preprocess the input data.
data(tuple): Input data tuple.
dict - Preprocessed data dictionary.
_denormalize_data(data)
Denormalize the input data.
data(np.ndarray): Input data array.
np.ndarray - Denormalized data array.
Example usage
Notes
- The dataset automatically adjusts horizon length to be at most 30% of the data length
- Supports special boundary values:
(-1, -1, -1)uses all data for training - When
normalize=True, a StandardScaler is fitted on the training data