Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset tutorial new #117

Merged
merged 5 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configs/transforms/dataset_defaults/REDDIT-BINARY.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
defaults:
- data_manipulations: equal_gaus_features
- data_manipulations@equal_gaus_features: equal_gaus_features
- liftings@_here_: ${get_required_lifting:graph,${model}}
10 changes: 9 additions & 1 deletion topobenchmarkx/data/datasets/us_county_demos_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,16 @@ def download(self) -> None:
dataset_name=self.name,
file_format=self.file_format,
)
# Extract zip file

# Step 2: extract zip file
folder = self.raw_dir
filename = f"{self.name}.{self.file_format}"
path = osp.join(folder, filename)
extract_zip(path, folder)
# Delete zip file
os.unlink(path)

# Step 3: organize files
# Move files from osp.join(folder, name_download) to folder
for file in os.listdir(osp.join(folder, self.name)):
shutil.move(osp.join(folder, self.name, file), folder)
Expand All @@ -161,12 +164,17 @@ def process(self) -> None:
processing transformations if specified, and saves the processed data
to the appropriate location.
"""
# Step 1: extract the data
data = read_us_county_demos(
self.raw_dir, self.year, self.task_variable
)
data_list = [data]

# Step 2: collate the graphs
self.data, self.slices = self.collate(data_list)
self._data_list = None # Reset cache.

# Step 3: save processed data
fs.torch_save(
(self._data.to_dict(), self.slices, {}, self._data.__class__),
self.processed_paths[0],
Expand Down
4 changes: 2 additions & 2 deletions tutorials/homophily_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_97245/3190777372.py:20: UserWarning: \n",
"/tmp/ipykernel_1117779/40423503.py:21: UserWarning: \n",
"The version_base parameter is not specified.\n",
"Please specify a compatability version level, or None.\n",
"Will assume defaults for version 1.1\n",
Expand Down Expand Up @@ -90,7 +90,7 @@
}
],
"source": [
"cfg = hydra.compose(config_name=\"run.yaml\", overrides=[\"model=hypergraph/unignn2\",\"dataset=hypergraph/coauthorship_cora\",\"transforms=data_manipulations/group_homophily\" ], return_hydra_config=True)\n",
"cfg = hydra.compose(config_name=\"run.yaml\", overrides=[\"model=hypergraph/unignn2\", \"dataset=hypergraph/coauthorship_cora\"], return_hydra_config=True)\n",
"loader = hydra.utils.instantiate(cfg.dataset.loader)\n",
"\n",
"dataset, dataset_dir = loader.load()\n",
Expand Down
Loading
Loading