Convert to Parquet format for datasets>=3.0 compatibility

#1
by kashif HF Staff - opened
ETTh.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d9f0a073652ec2416b6ad5ec9a3fe996dca0410506562fa9eef53ab38b4f222b
3
+ size 570693
ETTm.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ab5c02f4279e935484a874535b7e04d0ce56968a40a26c27dbf455305773e6a
3
+ size 2069471
README.md CHANGED
@@ -1,247 +1,55 @@
1
  ---
2
- pretty_name: Chronos datasets (extra)
3
- annotations_creators:
4
- - no-annotation
5
- source_datasets:
6
- - original
7
- task_categories:
8
- - time-series-forecasting
9
- task_ids:
10
- - univariate-time-series-forecasting
11
- - multivariate-time-series-forecasting
12
  license: apache-2.0
13
- dataset_info:
14
- - config_name: ETTh
15
- features:
16
- - name: id
17
- dtype: string
18
- - name: timestamp
19
- sequence: timestamp[ns]
20
- - name: HUFL
21
- sequence: float64
22
- - name: HULL
23
- sequence: float64
24
- - name: MUFL
25
- sequence: float64
26
- - name: MULL
27
- sequence: float64
28
- - name: LUFL
29
- sequence: float64
30
- - name: LULL
31
- sequence: float64
32
- - name: OT
33
- sequence: float64
34
- splits:
35
- - name: train
36
- num_bytes: 2229840
37
- num_examples: 2
38
- download_size: 0
39
- dataset_size: 2229840
40
- - config_name: ETTm
41
- features:
42
- - name: id
43
- dtype: string
44
- - name: timestamp
45
- sequence: timestamp[ms]
46
- - name: HUFL
47
- sequence: float64
48
- - name: HULL
49
- sequence: float64
50
- - name: MUFL
51
- sequence: float64
52
- - name: MULL
53
- sequence: float64
54
- - name: LUFL
55
- sequence: float64
56
- - name: LULL
57
- sequence: float64
58
- - name: OT
59
- sequence: float64
60
- splits:
61
- - name: train
62
- num_bytes: 8919120
63
- num_examples: 2
64
- download_size: 0
65
- dataset_size: 8919120
66
- - config_name: brazilian_cities_temperature
67
- features:
68
- - name: id
69
- dtype: string
70
- - name: timestamp
71
- sequence: timestamp[ms]
72
- - name: temperature
73
- sequence: float32
74
- splits:
75
- - name: train
76
- num_bytes: 109234
77
- num_examples: 12
78
- download_size: 0
79
- dataset_size: 109234
80
- - config_name: spanish_energy_and_weather
81
- features:
82
- - name: timestamp
83
- sequence: timestamp[ms]
84
- - name: generation_biomass
85
- sequence: float64
86
- - name: generation_fossil_brown_coal/lignite
87
- sequence: float64
88
- - name: generation_fossil_gas
89
- sequence: float64
90
- - name: generation_fossil_hard_coal
91
- sequence: float64
92
- - name: generation_fossil_oil
93
- sequence: float64
94
- - name: generation_hydro_pumped_storage_consumption
95
- sequence: float64
96
- - name: generation_hydro_run-of-river_and_poundage
97
- sequence: float64
98
- - name: generation_hydro_water_reservoir
99
- sequence: float64
100
- - name: generation_nuclear
101
- sequence: float64
102
- - name: generation_other
103
- sequence: float64
104
- - name: generation_other_renewable
105
- sequence: float64
106
- - name: generation_solar
107
- sequence: float64
108
- - name: generation_waste
109
- sequence: float64
110
- - name: generation_wind_onshore
111
- sequence: float64
112
- - name: total_load_actual
113
- sequence: float64
114
- - name: price_actual
115
- sequence: float64
116
- - name: Barcelona_temp
117
- sequence: float64
118
- - name: Bilbao_temp
119
- sequence: float64
120
- - name: Madrid_temp
121
- sequence: float64
122
- - name: Seville_temp
123
- sequence: float64
124
- - name: Valencia_temp
125
- sequence: float64
126
- - name: Barcelona_temp_min
127
- sequence: float64
128
- - name: Bilbao_temp_min
129
- sequence: float64
130
- - name: Madrid_temp_min
131
- sequence: float64
132
- - name: Seville_temp_min
133
- sequence: float64
134
- - name: Valencia_temp_min
135
- sequence: float64
136
- - name: Barcelona_temp_max
137
- sequence: float64
138
- - name: Bilbao_temp_max
139
- sequence: float64
140
- - name: Madrid_temp_max
141
- sequence: float64
142
- - name: Seville_temp_max
143
- sequence: float64
144
- - name: Valencia_temp_max
145
- sequence: float64
146
- - name: Barcelona_pressure
147
- sequence: float64
148
- - name: Bilbao_pressure
149
- sequence: float64
150
- - name: Madrid_pressure
151
- sequence: float64
152
- - name: Seville_pressure
153
- sequence: float64
154
- - name: Valencia_pressure
155
- sequence: float64
156
- - name: Barcelona_humidity
157
- sequence: float64
158
- - name: Bilbao_humidity
159
- sequence: float64
160
- - name: Madrid_humidity
161
- sequence: float64
162
- - name: Seville_humidity
163
- sequence: float64
164
- - name: Valencia_humidity
165
- sequence: float64
166
- - name: Barcelona_wind_speed
167
- sequence: float64
168
- - name: Bilbao_wind_speed
169
- sequence: float64
170
- - name: Madrid_wind_speed
171
- sequence: float64
172
- - name: Seville_wind_speed
173
- sequence: float64
174
- - name: Valencia_wind_speed
175
- sequence: float64
176
- - name: Barcelona_wind_deg
177
- sequence: float64
178
- - name: Bilbao_wind_deg
179
- sequence: float64
180
- - name: Madrid_wind_deg
181
- sequence: float64
182
- - name: Seville_wind_deg
183
- sequence: float64
184
- - name: Valencia_wind_deg
185
- sequence: float64
186
- - name: Barcelona_rain_1h
187
- sequence: float64
188
- - name: Bilbao_rain_1h
189
- sequence: float64
190
- - name: Madrid_rain_1h
191
- sequence: float64
192
- - name: Seville_rain_1h
193
- sequence: float64
194
- - name: Valencia_rain_1h
195
- sequence: float64
196
- - name: Barcelona_snow_3h
197
- sequence: float64
198
- - name: Bilbao_snow_3h
199
- sequence: float64
200
- - name: Madrid_snow_3h
201
- sequence: float64
202
- - name: Seville_snow_3h
203
- sequence: float64
204
- - name: Valencia_snow_3h
205
- sequence: float64
206
- - name: Barcelona_clouds_all
207
- sequence: float64
208
- - name: Bilbao_clouds_all
209
- sequence: float64
210
- - name: Madrid_clouds_all
211
- sequence: float64
212
- - name: Seville_clouds_all
213
- sequence: float64
214
- - name: Valencia_clouds_all
215
- sequence: float64
216
- splits:
217
- - name: train
218
- num_bytes: 18794572
219
- num_examples: 1
220
- download_size: 0
221
- dataset_size: 18794572
222
  ---
223
 
224
- # Chronos datasets
225
 
226
- Time series datasets used for training and evaluation of the [Chronos](https://github.com/amazon-science/chronos-forecasting) forecasting models.
 
227
 
228
- This repository contains scripts for constructing datasets that cannot be hosted in the [main Chronos datasets repository](https://huggingface.co/datasets/autogluon/chronos_datasets) due to license restrictions.
229
 
 
 
 
 
230
 
231
  ## Usage
232
 
233
- Datasets can be loaded using the 🤗 [`datasets`](https://huggingface.co/docs/datasets/en/index) library
234
  ```python
235
- import datasets
 
 
 
236
 
237
- ds = datasets.load_dataset("autogluon/chronos_datasets_extra", "ETTh", split="train", trust_remote_code=True)
238
- ds.set_format("numpy") # sequences returned as numpy arrays
239
  ```
240
 
241
- For more information about the data format and usage please refer to [`autogluon/chronos_datasets`](https://huggingface.co/datasets/autogluon/chronos_datasets).
242
 
 
 
 
243
 
244
  ## License
245
- Different datasets available in this collection are distributed under different open source licenses. Please see `ds.info.license` and `ds.info.homepage` for each individual dataset.
246
 
247
- The dataset script provided in this repository (`chronos_datasets_extra.py`) is available under the Apache 2.0 License.
 
 
 
 
1
  ---
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
+ task_categories:
4
+ - time-series-forecasting
5
+ tags:
6
+ - chronos
7
+ - time-series
8
+ pretty_name: Chronos Datasets Extra (Parquet)
9
+ configs:
10
+ - config_name: ETTh
11
+ data_files: ETTh.parquet
12
+ - config_name: ETTm
13
+ data_files: ETTm.parquet
14
+ - config_name: brazilian_cities_temperature
15
+ data_files: brazilian_cities_temperature.parquet
16
+ - config_name: spanish_energy_and_weather
17
+ data_files: spanish_energy_and_weather.parquet
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  ---
19
 
20
+ # Chronos Datasets Extra (Parquet Format)
21
 
22
+ This dataset is a Parquet-format version of the original `autogluon/chronos_datasets_extra` dataset.
23
+ It does not require `trust_remote_code` and works with `datasets>=3.0`.
24
 
25
+ ## Datasets
26
 
27
+ - **ETTh**: Electricity Transformer Temperature (hourly) - 2 regions
28
+ - **ETTm**: Electricity Transformer Temperature (minutely) - 2 regions
29
+ - **brazilian_cities_temperature**: Monthly temperature data for Brazilian cities
30
+ - **spanish_energy_and_weather**: Spanish energy consumption and weather data
31
 
32
  ## Usage
33
 
 
34
  ```python
35
+ from datasets import load_dataset
36
+
37
+ # Load ETTh dataset
38
+ ds = load_dataset("autogluon/chronos_datasets_extra", "ETTh", split="train")
39
 
40
+ # Load Brazilian temperature dataset
41
+ ds = load_dataset("autogluon/chronos_datasets_extra", "brazilian_cities_temperature", split="train")
42
  ```
43
 
44
+ ## Original Source
45
 
46
+ - ETT datasets: https://github.com/zhouhaoyi/ETDataset
47
+ - Spanish energy: https://www.kaggle.com/datasets/nicholasjhana/energy-consumption-generation-prices-and-weather
48
+ - Brazilian temperature: https://www.kaggle.com/datasets/volpatto/temperature-timeseries-for-some-brazilian-cities
49
 
50
  ## License
 
51
 
52
+ The datasets have various licenses from their original sources:
53
+ - ETT: CC BY-ND 4.0
54
+ - Brazilian temperature: Database Contents License (DbCL) v1.0
55
+ - Spanish energy: See original Kaggle dataset
brazilian_cities_temperature.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b18f21946495d42398951d6f6b368d42e6648fea3ac058cf1903fdd77c788384
3
+ size 32275
chronos_datasets_extra.py DELETED
@@ -1,208 +0,0 @@
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
- import tempfile
15
- from pathlib import Path
16
-
17
- import datasets
18
- import pandas as pd
19
-
20
- _VERSION = "1.0.0"
21
-
22
- _DESCRIPTION = "Chronos datasets"
23
-
24
- _CITATION = """
25
- @article{ansari2024chronos,
26
- author = {Ansari, Abdul Fatir and Stella, Lorenzo and Turkmen, Caner and Zhang, Xiyuan, and Mercado, Pedro and Shen, Huibin and Shchur, Oleksandr and Rangapuram, Syama Syndar and Pineda Arango, Sebastian and Kapoor, Shubham and Zschiegner, Jasper and Maddix, Danielle C. and Wang, Hao and Mahoney, Michael W. and Torkkola, Kari and Gordon Wilson, Andrew and Bohlke-Schneider, Michael and Wang, Yuyang},
27
- title = {Chronos: Learning the Language of Time Series},
28
- journal = {arXiv preprint arXiv:2403.07815},
29
- year = {2024}
30
- }
31
- """
32
-
33
-
34
- _ETTH = "ETTh"
35
- _ETTM = "ETTm"
36
- _SPANISH_ENERGY_AND_WEATHER = "spanish_energy_and_weather"
37
- _BRAZILIAN_TEMPERATURE = "brazilian_cities_temperature"
38
-
39
-
40
- class ChronosExtraConfig(datasets.BuilderConfig):
41
- def __init__(
42
- self,
43
- name: str,
44
- license: str = None,
45
- homepage: str = None,
46
- **kwargs,
47
- ):
48
- super().__init__(name=name, **kwargs)
49
- self.license = license
50
- self.homepage = homepage
51
-
52
-
53
- class ChronosExtraBuilder(datasets.GeneratorBasedBuilder):
54
- BUILDER_CONFIG_CLASS = ChronosExtraConfig
55
- BUILDER_CONFIGS = [
56
- ChronosExtraConfig(
57
- name=_ETTH,
58
- license="CC BY-ND 4.0",
59
- homepage="https://github.com/zhouhaoyi/ETDataset",
60
- version=_VERSION,
61
- ),
62
- ChronosExtraConfig(
63
- name=_ETTM,
64
- license="CC BY-ND 4.0",
65
- homepage="https://github.com/zhouhaoyi/ETDataset",
66
- version=_VERSION,
67
- ),
68
- ChronosExtraConfig(
69
- name=_BRAZILIAN_TEMPERATURE,
70
- license="Database Contents License (DbCL) v1.0",
71
- homepage="https://www.kaggle.com/datasets/volpatto/temperature-timeseries-for-some-brazilian-cities",
72
- version=_VERSION,
73
- ),
74
- ChronosExtraConfig(
75
- name=_SPANISH_ENERGY_AND_WEATHER,
76
- homepage="https://www.kaggle.com/datasets/nicholasjhana/energy-consumption-generation-prices-and-weather",
77
- version=_VERSION,
78
- ),
79
- ]
80
-
81
- def _info(self):
82
- return datasets.DatasetInfo(
83
- description=_DESCRIPTION,
84
- citation=_CITATION,
85
- version=self.config.version,
86
- license=self.config.license,
87
- homepage=self.config.homepage,
88
- )
89
-
90
- def _split_generators(self, dl_manager):
91
- return [
92
- datasets.SplitGenerator(name=datasets.Split.TRAIN),
93
- ]
94
-
95
- def _generate_examples(self):
96
- if self.config.name in [_ETTH, _ETTM]:
97
- yield from _ett_generator(self.config.name)
98
- elif self.config.name == _SPANISH_ENERGY_AND_WEATHER:
99
- yield from _spanish_energy_generator()
100
- elif self.config.name == _BRAZILIAN_TEMPERATURE:
101
- yield from _brazilian_temperature_generator()
102
-
103
-
104
- def _ett_generator(name: str):
105
- for region in [1, 2]:
106
- url = f"https://raw.githubusercontent.com/zhouhaoyi/ETDataset/main/ETT-small/{name}{region}.csv?download=1"
107
- df = pd.read_csv(url, parse_dates=["date"])
108
- df = df.rename(columns={"date": "timestamp"})
109
- entry = {"id": f"{name}{region}"}
110
- for col in df.columns:
111
- entry[col] = df[col].to_numpy()
112
- yield region, entry
113
-
114
-
115
- def _download_from_kaggle(dataset_name, download_path) -> None:
116
- from kaggle.api.kaggle_api_extended import KaggleApi
117
-
118
- api = KaggleApi()
119
- api.authenticate()
120
- api.dataset_download_files(dataset_name, path=download_path, unzip=True)
121
-
122
-
123
- def _spanish_energy_generator():
124
- with tempfile.TemporaryDirectory() as download_path:
125
- _download_from_kaggle(
126
- "nicholasjhana/energy-consumption-generation-prices-and-weather",
127
- download_path,
128
- )
129
- download_path = Path(download_path)
130
- df_energy = pd.read_csv(download_path / "energy_dataset.csv")
131
- df_energy["time"] = pd.to_datetime(df_energy["time"], utc=True)
132
- df_energy.set_index("time", inplace=True)
133
-
134
- # Drop non-informative columns / columns containing forecasts
135
- constant_columns = df_energy.columns[df_energy.nunique() <= 1].to_list()
136
- forecast_columns = [
137
- col for col in df_energy.columns if "forecast" in col or "day ahead" in col
138
- ]
139
- columns_to_drop = constant_columns + forecast_columns
140
- df_energy = df_energy.drop(columns_to_drop, axis=1)
141
-
142
- entry = {"id": "0", "timestamp": df_energy.index.to_numpy(dtype="datetime64[ms]")}
143
- for col in df_energy.columns:
144
- saved_name = col.replace(" ", "_")
145
- entry[saved_name] = df_energy[col].to_numpy(dtype="float64")
146
-
147
- # Weather data
148
- df_weather = pd.read_csv(download_path / "weather_features.csv")
149
- df_weather["dt_iso"] = pd.to_datetime(df_weather["dt_iso"], utc=True)
150
- df_weather = (
151
- df_weather.rename(columns={"dt_iso": "time"})
152
- .drop_duplicates(subset=["time", "city_name"], keep="first")
153
- .set_index("time")
154
- )
155
- weather_features = [
156
- "temp",
157
- "temp_min",
158
- "temp_max",
159
- "pressure",
160
- "humidity",
161
- "wind_speed",
162
- "wind_deg",
163
- "rain_1h",
164
- "snow_3h",
165
- "clouds_all",
166
- ]
167
- for feature in weather_features:
168
- for city, df_for_city in df_weather.groupby("city_name"):
169
- saved_name = f"{city.lstrip()}_{feature}"
170
- entry[saved_name] = df_for_city[feature].to_numpy(dtype="float64")
171
- assert df_for_city.index.equals(df_energy.index)
172
- yield 0, entry
173
-
174
-
175
- def _brazilian_temperature_generator():
176
- months = [
177
- "JAN",
178
- "FEB",
179
- "MAR",
180
- "APR",
181
- "MAY",
182
- "JUN",
183
- "JUL",
184
- "AUG",
185
- "SEP",
186
- "OCT",
187
- "NOV",
188
- "DEC",
189
- ]
190
- with tempfile.TemporaryDirectory() as download_path:
191
- _download_from_kaggle(
192
- "volpatto/temperature-timeseries-for-some-brazilian-cities", download_path
193
- )
194
- for filename in sorted(Path(download_path).iterdir()):
195
- city = filename.name.split("_", maxsplit=1)[1].split(".")[0]
196
- df = pd.read_csv(filename)
197
- df = df.set_index("YEAR")[months]
198
- first_timestamp = f"{df.index[0]}-01-01"
199
- df = df.stack()
200
- df[df == 999.9] = float("nan")
201
- entry = {
202
- "id": city,
203
- "timestamp": pd.date_range(
204
- first_timestamp, freq="MS", periods=len(df), unit="ms"
205
- ).to_numpy(),
206
- "temperature": df.to_numpy("float32"),
207
- }
208
- yield city, entry
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
spanish_energy_and_weather.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7427aecfb54be77d9a80f71c642f2d44e39751a52ccd7607f18ac8c6c3872c69
3
+ size 3228290