feat: added builder config for raw dataset
Browse files- airbnb_multicity.py +17 -5
airbnb_multicity.py
CHANGED
|
@@ -28,7 +28,7 @@ class AirbnbDataset(datasets.ArrowBasedBuilder):
|
|
| 28 |
BUILDER_CONFIGS = [
|
| 29 |
AirbnbDatasetConfig(
|
| 30 |
name = res,
|
| 31 |
-
description = f"This is the official train test split for Airbnb Datatset in h3 resolution = {res}. Benchmark cities are: Paris, London, Rome, Melbourne, New York City, Amsterdam."
|
| 32 |
data_url={
|
| 33 |
"train": f"https://huggingface.co/datasets/kraina/airbnb_multicity/resolve/main/data/{res}/airbnb_train.parquet",
|
| 34 |
"test": f"https://huggingface.co/datasets/kraina/airbnb_multicity/resolve/main/data/{res}/airbnb_test.parquet"
|
|
@@ -37,6 +37,14 @@ class AirbnbDataset(datasets.ArrowBasedBuilder):
|
|
| 37 |
for res in RESOLUTIONS
|
| 38 |
]
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def _info(self):
|
| 41 |
return datasets.DatasetInfo(
|
| 42 |
# This is the description that will appear on the datasets page.
|
|
@@ -71,11 +79,15 @@ class AirbnbDataset(datasets.ArrowBasedBuilder):
|
|
| 71 |
|
| 72 |
def _split_generators(self, dl_manager: datasets.download.DownloadManager):
|
| 73 |
downloaded_files = dl_manager.download(self.config.data_url)
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={'filepath': downloaded_files["train"]})
|
| 77 |
-
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={'filepath': downloaded_files["test"]})
|
| 78 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 80 |
def _generate_tables(self, filepath):
|
| 81 |
with open(filepath, mode="rb") as f:
|
|
|
|
| 28 |
BUILDER_CONFIGS = [
|
| 29 |
AirbnbDatasetConfig(
|
| 30 |
name = res,
|
| 31 |
+
description = f"This is the official train test split for Airbnb Datatset in h3 resolution = {res}. Benchmark cities are: Paris, London, Rome, Melbourne, New York City, Amsterdam.",
|
| 32 |
data_url={
|
| 33 |
"train": f"https://huggingface.co/datasets/kraina/airbnb_multicity/resolve/main/data/{res}/airbnb_train.parquet",
|
| 34 |
"test": f"https://huggingface.co/datasets/kraina/airbnb_multicity/resolve/main/data/{res}/airbnb_test.parquet"
|
|
|
|
| 37 |
for res in RESOLUTIONS
|
| 38 |
]
|
| 39 |
|
| 40 |
+
BUILDER_CONFIGS = BUILDER_CONFIGS + [
|
| 41 |
+
AirbnbDatasetConfig(
|
| 42 |
+
name="all",
|
| 43 |
+
description=f"This is a raw, full version of Airbnb Dataset."+DESCRIPTION,
|
| 44 |
+
data_url={"train":f"https://huggingface.co/datasets/kraina/airbnb_multicity/resolve/main/data/all_airbnb.parquet"}
|
| 45 |
+
|
| 46 |
+
)]
|
| 47 |
+
|
| 48 |
def _info(self):
|
| 49 |
return datasets.DatasetInfo(
|
| 50 |
# This is the description that will appear on the datasets page.
|
|
|
|
| 79 |
|
| 80 |
def _split_generators(self, dl_manager: datasets.download.DownloadManager):
|
| 81 |
downloaded_files = dl_manager.download(self.config.data_url)
|
| 82 |
+
if self.config.name == "all":
|
| 83 |
+
return [
|
| 84 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={'filepath': downloaded_files["train"]})
|
|
|
|
| 85 |
]
|
| 86 |
+
else:
|
| 87 |
+
return [
|
| 88 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={'filepath': downloaded_files["train"]}),
|
| 89 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={'filepath': downloaded_files["test"]})
|
| 90 |
+
]
|
| 91 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 92 |
def _generate_tables(self, filepath):
|
| 93 |
with open(filepath, mode="rb") as f:
|