Skip to content

Commit

Permalink
[Dataset & Transform] Synthetic Datasets for Explainability and SIGND…
Browse files Browse the repository at this point in the history
…iffusion Transform (dmlc#3982)

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Update

* Fix

* Update

* Update

* Update
  • Loading branch information
mufeili authored May 16, 2022
1 parent 03024f9 commit 65b0b9e
Show file tree
Hide file tree
Showing 8 changed files with 1,088 additions and 9 deletions.
5 changes: 5 additions & 0 deletions docs/source/api/python/dgl.data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Datasets for node classification/regression tasks
FraudDataset
FraudYelpDataset
FraudAmazonDataset
BAShapeDataset
BACommunityDataset
TreeCycleDataset
TreeGridDataset
BA2MotifDataset

Edge Prediction Datasets
---------------------------------------
Expand Down
1 change: 1 addition & 0 deletions docs/source/api/python/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ dgl.transforms
LaplacianPE
FeatMask
RowFeatNormalizer
SIGNDiffusion
1 change: 1 addition & 0 deletions python/dgl/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .fakenews import FakeNewsDataset
from .csv_dataset import CSVDataset
from .adapter import AsNodePredDataset, AsLinkPredDataset
from .synthetic import BAShapeDataset, BACommunityDataset, TreeCycleDataset, TreeGridDataset, BA2MotifDataset

def register_data_args(parser):
parser.add_argument(
Expand Down
11 changes: 6 additions & 5 deletions python/dgl/data/dgl_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DGLDataset(object):
1. Check whether there is a dataset cache on disk
(already processed and stored on the disk) by
invoking ``has_cache()``. If true, goto 5.
2. Call ``download()`` to download the data.
2. Call ``download()`` to download the data if ``url`` is not None.
3. Call ``process()`` to process the data.
4. Call ``save()`` to save the processed dataset on disk and goto 6.
5. Call ``load()`` to load the processed dataset from disk.
Expand All @@ -31,7 +31,7 @@ class DGLDataset(object):
name : str
Name of the dataset
url : str
Url to download the raw dataset
Url to download the raw dataset. Default: None
raw_dir : str
Specifying the directory that will store the
downloaded data or the directory that
Expand Down Expand Up @@ -313,6 +313,7 @@ def __init__(self, name, url, raw_dir=None, hash_key=(),
def download(self):
r""" Automatically download data and extract it.
"""
zip_file_path = os.path.join(self.raw_dir, self.name + '.zip')
download(self.url, path=zip_file_path)
extract_archive(zip_file_path, self.raw_path)
if self.url is not None:
zip_file_path = os.path.join(self.raw_dir, self.name + '.zip')
download(self.url, path=zip_file_path)
extract_archive(zip_file_path, self.raw_path)
Loading

0 comments on commit 65b0b9e

Please sign in to comment.