Datasets:

Multilinguality:
monolingual
Size Categories:
1K<n<10K
Language Creators:
found
Annotations Creators:
no-annotation
Source Datasets:
original
ArXiv:
Tags:
License:
kashif HF staff commited on
Commit
45a87fc
1 Parent(s): 3901f01

ETT time series dataset (#4213)

Browse files

* initial ETT dataset

* make univariate with covariates

* added factor for 15T dataset

* comments

* added readme

* removed unused imports

* added dummy dataset

* added dataset_info.json

* black

* remove whitespace

* fix readme

* added kashif

* fixed typos in readme

* fixed dataset name

Commit from https://github.com/huggingface/datasets/commit/15c98031c333eb50cb168da8ec88e2c59e2ba7fe

README.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - unknown
8
+ licenses:
9
+ - cc-by-4-0
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: Electricity Transformer Temperature
13
+ size_categories:
14
+ - 1K<n<10K
15
+ source_datasets:
16
+ - original
17
+ task_categories:
18
+ - time-series-forecasting
19
+ task_ids:
20
+ - univariate-time-series-forecasting
21
+ - multivariate-time-series-forecasting
22
+ ---
23
+
24
+ # Dataset Card for [Electricity Transformer Temperature](https://github.com/zhouhaoyi/ETDataset)
25
+
26
+ ## Table of Contents
27
+ - [Table of Contents](#table-of-contents)
28
+ - [Dataset Description](#dataset-description)
29
+ - [Dataset Summary](#dataset-summary)
30
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
31
+ - [Languages](#languages)
32
+ - [Dataset Structure](#dataset-structure)
33
+ - [Data Instances](#data-instances)
34
+ - [Data Fields](#data-fields)
35
+ - [Data Splits](#data-splits)
36
+ - [Dataset Creation](#dataset-creation)
37
+ - [Curation Rationale](#curation-rationale)
38
+ - [Source Data](#source-data)
39
+ - [Annotations](#annotations)
40
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
41
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
42
+ - [Social Impact of Dataset](#social-impact-of-dataset)
43
+ - [Discussion of Biases](#discussion-of-biases)
44
+ - [Other Known Limitations](#other-known-limitations)
45
+ - [Additional Information](#additional-information)
46
+ - [Dataset Curators](#dataset-curators)
47
+ - [Licensing Information](#licensing-information)
48
+ - [Citation Information](#citation-information)
49
+ - [Contributions](#contributions)
50
+
51
+ ## Dataset Description
52
+
53
+ - **Homepage:** [Electricity Transformer Dataset](https://github.com/zhouhaoyi/ETDataset)
54
+ - **Repository:** https://github.com/zhouhaoyi/ETDataset
55
+ - **Paper:** [Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting](https://arxiv.org/abs/2012.07436)
56
+ - **Point of Contact:** [Haoyi Zhou](mailto:zhouhy@act.buaa.edu.cn)
57
+
58
+ ### Dataset Summary
59
+
60
+ The electric power distribution problem is the distribution of electricity to different areas depending on its sequential usage. But predicting the future demand of a specific area is difficult, as it varies with weekdays, holidays, seasons, weather, temperatures, etc. However, no existing method can perform a long-term prediction based on super long-term real-world data with high precision. Any false predictions may damage the electrical transformer. So currently, without an efficient method to predict future electric usage, managers have to make decisions based on the empirical number, which is much higher than the real-world demands. It causes unnecessary waste of electric and equipment depreciation. On the other hand, the oil temperatures can reflect the condition of the Transformer. One of the most efficient strategies is to predict how the electrical transformers' oil temperature is safe and avoid unnecessary waste. As a result, to address this problem, the authors and Beijing Guowang Fuda Science & Technology Development Company have provided 2-years worth of data.
61
+
62
+ Specifically, the dataset combines short-term periodical patterns, long-term periodical patterns, long-term trends, and many irregular patterns. The dataset are obtained from 2 Electricity Transformers at 2 stations and come in an `1H` (hourly) or `15T` (15-minute) frequency containing 2 year * 365 days * 24 hours * (4 for 15T) times = 17,520 (70,080 for 15T) data points.
63
+
64
+ The target time series is the **O**il **T**emperature and the dataset comes with the following 6 covariates in the univariate setup:
65
+ * **H**igh **U**se**F**ul **L**oad
66
+ * **H**igh **U**se**L**ess **L**oad
67
+ * **M**iddle **U**se**F**ul **L**oad
68
+ * **M**iddle **U**se**L**ess **L**oad
69
+ * **L**ow **U**se**F**ul **L**oad
70
+ * **L**ow **U**se**L**ess **L**oad
71
+
72
+
73
+ ### Dataset Usage
74
+
75
+ To load a particular variant of the dataset just specify its name e.g:
76
+
77
+ ```python
78
+ load_dataset("ett", "m1", multivariate=False) # univariate 15-min frequency dataset from first transformer
79
+ ```
80
+
81
+ or to specify a prediction length:
82
+
83
+ ```python
84
+ load_dataset("ett", "h2", prediction_length=48) # multivariate dataset from second transformer with prediction length of 48 (hours)
85
+ ```
86
+
87
+
88
+ ### Supported Tasks and Leaderboards
89
+
90
+ The time series data is split into train/val/test set of 12/4/4 months respectively. Given the prediction length (default: 1 day (24 hours or 24*4 15T)) we create rolling windows of this size for the val/test sets.
91
+
92
+ #### `time-series-forecasting`
93
+
94
+ ##### `univariate-time-series-forecasting`
95
+
96
+ The univariate time series forecasting tasks involves learning the future one dimensional `target` values of a time series in a dataset for some `prediction_length` time steps. The performance of the forecast models can then be validated via the ground truth in the `validation` split and tested via the `test` split. The covriates are stored in the `feat_dynamic_real` key of each time series.
97
+
98
+ ##### `multivariate-time-series-forecasting`
99
+
100
+ The multivariate time series forecasting task involves learning the future vector of `target` values of a time series in a dataset for some `prediction_length` time steps. Similar to the univariate setting the performance of a multivariate model can be validated via the ground truth in the `validation` split and tested via the `test` split.
101
+
102
+
103
+ ### Languages
104
+
105
+ ## Dataset Structure
106
+
107
+ ### Data Instances
108
+
109
+ A sample from the training set is provided below:
110
+
111
+ ```python
112
+ {
113
+ 'start': datetime.datetime(2012, 1, 1, 0, 0),
114
+ 'target': [14.0, 18.0, 21.0, 20.0, 22.0, 20.0, ...],
115
+ 'feat_static_cat': [0],
116
+ 'feat_dynamic_real': [[0.3, 0.4], [0.1, 0.6], ...],
117
+ 'item_id': 'OT'
118
+ }
119
+ ```
120
+
121
+ ### Data Fields
122
+
123
+ For the univariate regular time series each series has the following keys:
124
+
125
+ * `start`: a datetime of the first entry of each time series in the dataset
126
+ * `target`: an array[float32] of the actual target values
127
+ * `feat_static_cat`: an array[uint64] which contains a categorical identifier of each time series in the dataset
128
+ * `feat_dynamic_real`: optional array of covariate features
129
+ * `item_id`: a string identifier of each time series in a dataset for reference
130
+
131
+ For the multivariate time series the `target` is a vector of the multivariate dimension for each time point.
132
+
133
+ ### Data Splits
134
+
135
+ The time series data is split into train/val/test set of 12/4/4 months respectively.
136
+
137
+ ## Dataset Creation
138
+
139
+ ### Curation Rationale
140
+
141
+ Develop time series methods that can perform a long-term prediction based on super long-term real-world data with high precision.
142
+
143
+ ### Source Data
144
+
145
+ #### Initial Data Collection and Normalization
146
+
147
+ [More Information Needed]
148
+
149
+ #### Who are the source language producers?
150
+
151
+ [More Information Needed]
152
+
153
+ ### Annotations
154
+
155
+ #### Annotation process
156
+
157
+ [More Information Needed]
158
+
159
+ #### Who are the annotators?
160
+
161
+ [More Information Needed]
162
+
163
+ ### Personal and Sensitive Information
164
+
165
+ [More Information Needed]
166
+
167
+ ## Considerations for Using the Data
168
+
169
+ ### Social Impact of Dataset
170
+
171
+ [More Information Needed]
172
+
173
+ ### Discussion of Biases
174
+
175
+ [More Information Needed]
176
+
177
+ ### Other Known Limitations
178
+
179
+ [More Information Needed]
180
+
181
+ ## Additional Information
182
+
183
+ ### Dataset Curators
184
+
185
+ * [Haoyi Zhou](mailto:zhouhy@act.buaa.edu.cn)
186
+
187
+ ### Licensing Information
188
+
189
+ [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/legalcode)
190
+
191
+ ### Citation Information
192
+
193
+ ```tex
194
+ @inproceedings{haoyietal-informer-2021,
195
+ author = {Haoyi Zhou and
196
+ Shanghang Zhang and
197
+ Jieqi Peng and
198
+ Shuai Zhang and
199
+ Jianxin Li and
200
+ Hui Xiong and
201
+ Wancai Zhang},
202
+ title = {Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting},
203
+ booktitle = {The Thirty-Fifth {AAAI} Conference on Artificial Intelligence, {AAAI} 2021, Virtual Conference},
204
+ volume = {35},
205
+ number = {12},
206
+ pages = {11106--11115},
207
+ publisher = {{AAAI} Press},
208
+ year = {2021},
209
+ }
210
+ ```
211
+
212
+ ### Contributions
213
+
214
+ Thanks to [@kashif](https://github.com/kashif) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"h1": {"description": "The data of Electricity Transformers from two separated counties\nin China collected for two years at hourly and 15-min frequencies.\nEach data point consists of the target value \"oil temperature\" and\n6 power load features. The train/val/test is 12/4/4 months.\n", "citation": "@inproceedings{haoyietal-informer-2021,\n author = {Haoyi Zhou and\n Shanghang Zhang and\n Jieqi Peng and\n Shuai Zhang and\n Jianxin Li and\n Hui Xiong and\n Wancai Zhang},\n title = {Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting},\n booktitle = {The Thirty-Fifth {AAAI} Conference on Artificial Intelligence, {AAAI} 2021, Virtual Conference},\n volume = {35},\n number = {12},\n pages = {11106--11115},\n publisher = {{AAAI} Press},\n year = {2021},\n}\n", "homepage": "https://github.com/zhouhaoyi/ETDataset", "license": "The Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/", "features": {"start": {"dtype": "timestamp[s]", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_static_cat": {"feature": {"dtype": "uint64", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_dynamic_real": {"feature": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "item_id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ett", "config_name": "h1", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 249540, "num_examples": 1, "dataset_name": "ett"}, "test": {"name": "test", "num_bytes": 79930740, "num_examples": 240, "dataset_name": "ett"}, "validation": {"name": "validation", "num_bytes": 34975770, "num_examples": 120, "dataset_name": "ett"}}, "download_checksums": {"https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTh1.csv": {"num_bytes": 2589657, "checksum": "f18de3ad269cef59bb07b5438d79bb3042d3be49bdeecf01c1cd6d29695ee066"}}, "download_size": 2589657, "post_processing_size": null, "dataset_size": 115156050, "size_in_bytes": 117745707}, "h2": {"description": "The data of Electricity Transformers from two separated counties\nin China collected for two years at hourly and 15-min frequencies.\nEach data point consists of the target value \"oil temperature\" and\n6 power load features. The train/val/test is 12/4/4 months.\n", "citation": "@inproceedings{haoyietal-informer-2021,\n author = {Haoyi Zhou and\n Shanghang Zhang and\n Jieqi Peng and\n Shuai Zhang and\n Jianxin Li and\n Hui Xiong and\n Wancai Zhang},\n title = {Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting},\n booktitle = {The Thirty-Fifth {AAAI} Conference on Artificial Intelligence, {AAAI} 2021, Virtual Conference},\n volume = {35},\n number = {12},\n pages = {11106--11115},\n publisher = {{AAAI} Press},\n year = {2021},\n}\n", "homepage": "https://github.com/zhouhaoyi/ETDataset", "license": "The Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/", "features": {"start": {"dtype": "timestamp[s]", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_static_cat": {"feature": {"dtype": "uint64", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_dynamic_real": {"feature": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "item_id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ett", "config_name": "h2", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 249540, "num_examples": 1, "dataset_name": "ett"}, "test": {"name": "test", "num_bytes": 79930740, "num_examples": 240, "dataset_name": "ett"}, "validation": {"name": "validation", "num_bytes": 34975770, "num_examples": 120, "dataset_name": "ett"}}, "download_checksums": {"https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTh2.csv": {"num_bytes": 2417960, "checksum": "a3dc2c597b9218c7ce1cd55eb77b283fd459a1d09d753063f944967dd6b9218b"}}, "download_size": 2417960, "post_processing_size": null, "dataset_size": 115156050, "size_in_bytes": 117574010}, "m1": {"description": "The data of Electricity Transformers from two separated counties\nin China collected for two years at hourly and 15-min frequencies.\nEach data point consists of the target value \"oil temperature\" and\n6 power load features. The train/val/test is 12/4/4 months.\n", "citation": "@inproceedings{haoyietal-informer-2021,\n author = {Haoyi Zhou and\n Shanghang Zhang and\n Jieqi Peng and\n Shuai Zhang and\n Jianxin Li and\n Hui Xiong and\n Wancai Zhang},\n title = {Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting},\n booktitle = {The Thirty-Fifth {AAAI} Conference on Artificial Intelligence, {AAAI} 2021, Virtual Conference},\n volume = {35},\n number = {12},\n pages = {11106--11115},\n publisher = {{AAAI} Press},\n year = {2021},\n}\n", "homepage": "https://github.com/zhouhaoyi/ETDataset", "license": "The Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/", "features": {"start": {"dtype": "timestamp[s]", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_static_cat": {"feature": {"dtype": "uint64", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_dynamic_real": {"feature": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "item_id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ett", "config_name": "m1", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 997980, "num_examples": 1, "dataset_name": "ett"}, "test": {"name": "test", "num_bytes": 0, "num_examples": 0, "dataset_name": "ett"}, "validation": {"name": "validation", "num_bytes": 0, "num_examples": 0, "dataset_name": "ett"}}, "download_checksums": {"https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTm1.csv": {"num_bytes": 10360719, "checksum": "6ce1759b1a18e3328421d5d75fadcb316c449fcd7cec32820c8dafda71986c9e"}}, "download_size": 10360719, "post_processing_size": null, "dataset_size": 997980, "size_in_bytes": 11358699}, "m2": {"description": "The data of Electricity Transformers from two separated counties\nin China collected for two years at hourly and 15-min frequencies.\nEach data point consists of the target value \"oil temperature\" and\n6 power load features. The train/val/test is 12/4/4 months.\n", "citation": "@inproceedings{haoyietal-informer-2021,\n author = {Haoyi Zhou and\n Shanghang Zhang and\n Jieqi Peng and\n Shuai Zhang and\n Jianxin Li and\n Hui Xiong and\n Wancai Zhang},\n title = {Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting},\n booktitle = {The Thirty-Fifth {AAAI} Conference on Artificial Intelligence, {AAAI} 2021, Virtual Conference},\n volume = {35},\n number = {12},\n pages = {11106--11115},\n publisher = {{AAAI} Press},\n year = {2021},\n}\n", "homepage": "https://github.com/zhouhaoyi/ETDataset", "license": "The Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/", "features": {"start": {"dtype": "timestamp[s]", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_static_cat": {"feature": {"dtype": "uint64", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "feat_dynamic_real": {"feature": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "item_id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "ett", "config_name": "m2", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 997980, "num_examples": 1, "dataset_name": "ett"}, "test": {"name": "test", "num_bytes": 0, "num_examples": 0, "dataset_name": "ett"}, "validation": {"name": "validation", "num_bytes": 0, "num_examples": 0, "dataset_name": "ett"}}, "download_checksums": {"https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTm2.csv": {"num_bytes": 9677236, "checksum": "db973ca252c6410a30d0469b13d696cf919648d0f3fd588c60f03fdbdbadd1fd"}}, "download_size": 9677236, "post_processing_size": null, "dataset_size": 997980, "size_in_bytes": 10675216}}
dummy/h1/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff7007e9aa6ef9d12714df177250528f3899730166a7441f47342c4b0aa6d18e
3
+ size 535
dummy/h2/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6e27267dc2d291c54e45d03b7f00a16672eb89771e4c462d321bf175976c3be
3
+ size 549
dummy/m1/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02a6a92a71f0d19d9ec4d5f96f1a681a4a849ab1f87edbd53747e7dc6358726d
3
+ size 499
dummy/m2/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a388f1645cf5d38e3625295ecb0f6a31f9d66ce1a1f028a258ac54358306f4d0
3
+ size 551
ett.py ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Electricity Transformer Temperature (ETT) dataset."""
15
+ from dataclasses import dataclass
16
+
17
+ import pandas as pd
18
+
19
+ import datasets
20
+
21
+
22
+ _CITATION = """\
23
+ @inproceedings{haoyietal-informer-2021,
24
+ author = {Haoyi Zhou and
25
+ Shanghang Zhang and
26
+ Jieqi Peng and
27
+ Shuai Zhang and
28
+ Jianxin Li and
29
+ Hui Xiong and
30
+ Wancai Zhang},
31
+ title = {Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting},
32
+ booktitle = {The Thirty-Fifth {AAAI} Conference on Artificial Intelligence, {AAAI} 2021, Virtual Conference},
33
+ volume = {35},
34
+ number = {12},
35
+ pages = {11106--11115},
36
+ publisher = {{AAAI} Press},
37
+ year = {2021},
38
+ }
39
+ """
40
+
41
+ _DESCRIPTION = """\
42
+ The data of Electricity Transformers from two separated counties
43
+ in China collected for two years at hourly and 15-min frequencies.
44
+ Each data point consists of the target value "oil temperature" and
45
+ 6 power load features. The train/val/test is 12/4/4 months.
46
+ """
47
+
48
+ _HOMEPAGE = "https://github.com/zhouhaoyi/ETDataset"
49
+
50
+ _LICENSE = "The Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/"
51
+
52
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
53
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
54
+ _URLS = {
55
+ "h1": "https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTh1.csv",
56
+ "h2": "https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTh2.csv",
57
+ "m1": "https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTm1.csv",
58
+ "m2": "https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/ETTm2.csv",
59
+ }
60
+
61
+
62
+ @dataclass
63
+ class ETTBuilderConfig(datasets.BuilderConfig):
64
+ """ETT builder config."""
65
+
66
+ prediction_length: int = 24
67
+ multivariate: bool = False
68
+
69
+
70
+ class ETT(datasets.GeneratorBasedBuilder):
71
+ """Electricity Transformer Temperature (ETT) dataset"""
72
+
73
+ VERSION = datasets.Version("1.0.0")
74
+
75
+ # You will be able to load one or the other configurations in the following list with
76
+ # data = datasets.load_dataset('ett', 'h1')
77
+ # data = datasets.load_dataset('ett', 'm2')
78
+ BUILDER_CONFIGS = [
79
+ ETTBuilderConfig(
80
+ name="h1",
81
+ version=VERSION,
82
+ description="Time series from first county at hourly frequency.",
83
+ ),
84
+ ETTBuilderConfig(
85
+ name="h2",
86
+ version=VERSION,
87
+ description="Time series from second county at hourly frequency.",
88
+ ),
89
+ ETTBuilderConfig(
90
+ name="m1",
91
+ version=VERSION,
92
+ description="Time series from first county at 15-min frequency.",
93
+ ),
94
+ ETTBuilderConfig(
95
+ name="m2",
96
+ version=VERSION,
97
+ description="Time series from second county at 15-min frequency.",
98
+ ),
99
+ ]
100
+
101
+ DEFAULT_CONFIG_NAME = "h1" # It's not mandatory to have a default configuration. Just use one if it make sense.
102
+
103
+ def _info(self):
104
+ if self.config.multivariate:
105
+ features = datasets.Features(
106
+ {
107
+ "start": datasets.Value("timestamp[s]"),
108
+ "target": datasets.Sequence(datasets.Sequence(datasets.Value("float32"))),
109
+ "feat_static_cat": datasets.Sequence(datasets.Value("uint64")),
110
+ "item_id": datasets.Value("string"),
111
+ }
112
+ )
113
+ else:
114
+ features = datasets.Features(
115
+ {
116
+ "start": datasets.Value("timestamp[s]"),
117
+ "target": datasets.Sequence(datasets.Value("float32")),
118
+ "feat_static_cat": datasets.Sequence(datasets.Value("uint64")),
119
+ "feat_dynamic_real": datasets.Sequence(datasets.Sequence(datasets.Value("float32"))),
120
+ "item_id": datasets.Value("string"),
121
+ }
122
+ )
123
+
124
+ return datasets.DatasetInfo(
125
+ # This is the description that will appear on the datasets page.
126
+ description=_DESCRIPTION,
127
+ # This defines the different columns of the dataset and their types
128
+ features=features, # Here we define them above because they are different between the two configurations
129
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
130
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
131
+ # supervised_keys=("sentence", "label"),
132
+ # Homepage of the dataset for documentation
133
+ homepage=_HOMEPAGE,
134
+ # License for the dataset if available
135
+ license=_LICENSE,
136
+ # Citation for the dataset
137
+ citation=_CITATION,
138
+ )
139
+
140
+ def _split_generators(self, dl_manager):
141
+ urls = _URLS[self.config.name]
142
+ filepath = dl_manager.download_and_extract(urls)
143
+
144
+ return [
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.TRAIN,
147
+ # These kwargs will be passed to _generate_examples
148
+ gen_kwargs={
149
+ "filepath": filepath,
150
+ "split": "train",
151
+ },
152
+ ),
153
+ datasets.SplitGenerator(
154
+ name=datasets.Split.TEST,
155
+ # These kwargs will be passed to _generate_examples
156
+ gen_kwargs={
157
+ "filepath": filepath,
158
+ "split": "test",
159
+ },
160
+ ),
161
+ datasets.SplitGenerator(
162
+ name=datasets.Split.VALIDATION,
163
+ # These kwargs will be passed to _generate_examples
164
+ gen_kwargs={
165
+ "filepath": filepath,
166
+ "split": "dev",
167
+ },
168
+ ),
169
+ ]
170
+
171
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
172
+ def _generate_examples(self, filepath, split):
173
+ data = pd.read_csv(filepath, parse_dates=True, index_col=0)
174
+ start_date = data.index.min()
175
+
176
+ if self.config.name in ["m1", "m2"]:
177
+ factor = 4 # 15-min frequency
178
+ else:
179
+ factor = 1 # hourly frequency
180
+ train_end_date_index = 12 * 30 * 24 * factor # 1 year
181
+
182
+ if split == "dev":
183
+ end_date_index = 12 * 30 * 24 + 4 * 30 * 24 * factor # 1 year + 4 months
184
+ else:
185
+ end_date_index = 12 * 30 * 24 + 8 * 30 * 24 * factor # 1 year + 8 months
186
+
187
+ if self.config.multivariate:
188
+ if split in ["test", "dev"]:
189
+ # rolling windows of prediction_length for dev and test
190
+ for i, index in enumerate(
191
+ range(
192
+ train_end_date_index,
193
+ end_date_index,
194
+ self.config.prediction_length,
195
+ )
196
+ ):
197
+ yield i, {
198
+ "start": start_date,
199
+ "target": data[: index + self.config.prediction_length].values.astype("float32").T,
200
+ "feat_static_cat": [0],
201
+ "item_id": "0",
202
+ }
203
+ else:
204
+ yield 0, {
205
+ "start": start_date,
206
+ "target": data[:train_end_date_index].values.astype("float32").T,
207
+ "feat_static_cat": [0],
208
+ "item_id": "0",
209
+ }
210
+ else:
211
+ if split in ["test", "dev"]:
212
+ # rolling windows of prediction_length for dev and test
213
+ for i, index in enumerate(
214
+ range(
215
+ train_end_date_index,
216
+ end_date_index,
217
+ self.config.prediction_length,
218
+ )
219
+ ):
220
+ target = data["OT"][: index + self.config.prediction_length].values.astype("float32")
221
+ feat_dynamic_real = data[["HUFL", "HULL", "MUFL", "MULL", "LUFL", "LULL"]][
222
+ : index + self.config.prediction_length
223
+ ].values.T.astype("float32")
224
+ yield i, {
225
+ "start": start_date,
226
+ "target": target,
227
+ "feat_dynamic_real": feat_dynamic_real,
228
+ "feat_static_cat": [0],
229
+ "item_id": "OT",
230
+ }
231
+ else:
232
+ target = data["OT"][:train_end_date_index].values.astype("float32")
233
+ feat_dynamic_real = data[["HUFL", "HULL", "MUFL", "MULL", "LUFL", "LULL"]][
234
+ :train_end_date_index
235
+ ].values.T.astype("float32")
236
+ yield 0, {
237
+ "start": start_date,
238
+ "target": target,
239
+ "feat_dynamic_real": feat_dynamic_real,
240
+ "feat_static_cat": [0],
241
+ "item_id": "OT",
242
+ }