cogdl.datasets
¶
Submodules¶
Package Contents¶
Functions¶
|
New dataset types can be added to cogdl with the |
|
|
|
-
class
cogdl.datasets.
Dataset
(root, transform=None, pre_transform=None, pre_filter=None)[source]¶ Bases:
torch.utils.data.Dataset
Dataset base class for creating graph datasets. See here for the accompanying tutorial.
- Args:
root (string): Root directory where the dataset should be saved. transform (callable, optional): A function/transform that takes in an
cogdl.data.Data
object and returns a transformed version. The data object will be transformed before every access. (default:None
)- pre_transform (callable, optional): A function/transform that takes in
an
cogdl.data.Data
object and returns a transformed version. The data object will be transformed before being saved to disk. (default:None
)- pre_filter (callable, optional): A function that takes in an
cogdl.data.Data
object and returns a boolean value, indicating whether the data object should be included in the final dataset. (default:None
)
-
property
raw_file_names
(self)¶ The name of the files to find in the
self.raw_dir
folder in order to skip the download.
-
property
processed_file_names
(self)¶ The name of the files to find in the
self.processed_dir
folder in order to skip the processing.
-
abstract
download
(self)¶ Downloads the dataset to the
self.raw_dir
folder.
-
abstract
process
(self)¶ Processes the dataset to the
self.processed_dir
folder.
-
abstract
__len__
(self)¶ The number of examples in the dataset.
-
abstract
get
(self, idx)¶ Gets the data object at index
idx
.
-
property
num_features
(self)¶ Returns the number of features per node in the graph.
-
property
raw_paths
(self)¶ The filepaths to find in order to skip the download.
-
property
processed_paths
(self)¶ The filepaths to find in the
self.processed_dir
folder in order to skip the processing.
-
_download
(self)¶
-
_process
(self)¶
-
__getitem__
(self, idx)¶ Gets the data object at index
idx
and transforms it (in case aself.transform
is given).
-
__repr__
(self)¶
-
cogdl.datasets.
register_dataset
(name)[source]¶ New dataset types can be added to cogdl with the
register_dataset()
function decorator.For example:
@register_dataset('my_dataset') class MyDataset(): (...)
- Args:
name (str): the name of the dataset