MetaData
lsf_datasets.MetaData
A named tuple holding metadata about the loaded dataset split.
| Attribute | Type | Default | Description |
|---|---|---|---|
freq |
str |
- | (undocumented) |
target_dim |
int |
- | (undocumented) |
prediction_length |
int |
- | (undocumented) |
feat_dynamic_real_dim |
int |
0 |
(undocumented) |
past_feat_dynamic_real_dim |
int |
0 |
(undocumented) |
split |
str |
"test" |
(undocumented) |
LSFDatasetName
lsf_datasets.LSFDatasetName
An enumeration of supported dataset names.
Members:
* ETTh1
* ETTh2
* ETTm1
* ETTm2
* electricity
* weather
LSFDataset
lsf_datasets.LSFDataset
LSFDataset is a class for loading and processing time series datasets for evaluation purposes. It supports multiple datasets and modes of operation.
__init__(self, dataset_name: LSFDatasetName, mode: str = 'S', split: str = 'test', lsf_path: str = './data/')
Initializes the LSFDataset, loading and scaling the specified data split based on the dataset name and mode.
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset_name |
LSFDatasetName |
- | The name of the dataset to load. Supported values include "ETTh1", "ETTh2", "ETTm1", "ETTm2", "electricity", and "weather". |
mode |
str |
"S" |
The mode of operation. Supported values are: "S": Single target dimension. "M": Multi-target dimensions. "MS": Mixed single and multi-target dimensions. |
split |
str |
"test" |
The data split to use. Supported values are "train", "val", and "test". |
lsf_path |
str |
"./data/" |
The base path to the dataset files. |
Raises:
* ValueError: If an unknown dataset name or mode is provided.
__iter__(self)
Iterates over the dataset and yields data samples based on the mode of operation.
Returns: Iterator yielding data samples.
* For "S" mode, yields individual target dimensions: {"target": np.ndarray, "start": pd.Timestamp}.
* For "M" mode, yields all target dimensions transposed: {"target": np.ndarray, "start": pd.Timestamp}.
* For "MS" mode, yields individual target dimensions along with past features: {"target": np.ndarray, "past_feat_dynamic_real": np.ndarray, "start": pd.Timestamp}.
scale(self, data, start, end)
Scales the data using the mean and standard deviation of the training set.
| Parameter | Type | Default | Description |
|---|---|---|---|
data |
- | - | The data to scale. |
start |
- | - | The start index for the training set. |
end |
- | - | The end index for the training set. |
Returns: numpy.ndarray (The scaled data.)
compute_num_windows
lsf_datasets.compute_num_windows
Computes the number of windows that can fit inside the dataset length based on the stride and window length.
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset_length |
int |
- | (undocumented) |
window_length |
int |
- | (undocumented) |
window_stride |
int |
- | (undocumented) |
Returns: int
get_lsf_sub_dataset
lsf_datasets.get_lsf_sub_dataset
loads a subset from the LSF Dataset into a gluonTS TestData object
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset_name |
LSFDatasetName |
- | (undocumented) |
prediction_length |
int |
96 |
(undocumented) |
data_split |
str |
"test" |
(undocumented) |
mode |
str \| Literal["M", "S", "MS"] |
"M" |
(undocumented) |
eval_stride |
int |
32 |
(undocumented) |
lsf_path |
str |
"./data/" |
(undocumented) |
Returns: tuple[TestData, MetaData, _FileDataset]