GluonTS
ts_bolt.datamodules.gluonts¤
GluonTSDataLoaderConfig
dataclass
¤
Configs for dataloaders from a gluonts dataset
dl_config = GluonTSDataLoaderConfig(
batch_size=2,
transform=None,
collate_fn=None,
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batch_size |
int
|
batch size for the PyTorch DataLoader |
required |
transform |
Optional[Callable]
|
transforms of the PyTorch DataLoader, e.g., GluonTSTransformsDefault. |
required |
collate_fn |
Optional[Callable]
|
collate_fn of the PyTorch DataLoader, e.g., gluonts.torch.batchify.batchify |
required |
Source code in ts_bolt/datamodules/gluonts.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
GluonTSDataModule
¤
Bases: LightningDataModule
LightningDataModule from a gluonts dataset.
from gluonts.dataset.repository.datasets import get_dataset
gluonts_datasets = get_dataset("electricity")
train_dl_config = GluonTSDataLoaderConfig(
batch_size=2,
transform=None,
collate_fn=None,
)
test_dl_config = GluonTSDataLoaderConfig(
batch_size=10,
transform=None,
collate_fn=None,
)
dm = GluonTSDataModule(
train_dataset = gluonts_datasets.train,
test_dataset = gluonts_datasets.test,
train_dataloader_config = train_dl_config,
test_dataloader_config = test_dl_config,
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
train_dataset |
Dataset
|
gluonts Dataset for training |
required |
train_dataloader_config |
GluonTSDataLoaderConfig
|
config for train DataLoader |
required |
test_dataloader_config |
GluonTSDataLoaderConfig
|
config for the test DataLoader |
required |
Source code in ts_bolt/datamodules/gluonts.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
GluonTSDataset
¤
Bases: IterableDataset
An iter style dataset built from a gluonts dataset
from gluonts.dataset.repository.datasets import get_dataset
gluonts_datasets = get_dataset("electricity")
dataset = GluonTSDataset(
dataset = gluonts_datasets.train,
is_train = True
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
Dataset
|
gluonts dataset, e.g., TrainDatasets |
required |
is_train |
bool
|
whether the dataset is for training |
required |
transform |
Optional[Callable]
|
transformations on dataset, e.g., gluonts.transform.InstanceSplitter |
None
|
Source code in ts_bolt/datamodules/gluonts.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
GluonTSTransformsDefault
¤
Bases: Transformation
Default transforms of a gluonts dataset
gluonts_transform = GluonTSTransformsDefault(
context_length=10,
prediction_length=5,
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context_length |
int
|
the length of history input |
required |
prediction_length |
int
|
the length to be forecasted |
required |
Source code in ts_bolt/datamodules/gluonts.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|