mlx_graphs.datasets.Dataset#
- class mlx_graphs.datasets.Dataset(name: str, base_dir: str | None = None, pre_transform: Callable | None = None, transform: Callable | None = None)[source]#
Bases:
BaseDatasetA dataset class for graph data.
downloadandprocessmethods must be implemented by children classes. Thesaveandloadmethods save and load only the processedself.graphsattribute by default. You may want to override them to store/load additional processed attributes.Graph data within the dataset should be stored in
self.graphsas a list[GraphData]. The creation and preprocessing of this list of graphs is typically done within the overriddenprocessmethod.- Parameters:
name (
str) – name of the datasetbase_dir (
Optional[str]) – Directory where to store dataset files. Default is in the local directory.mlx_graphs_data/.pre_transform (
Optional[Callable]) – A function/transform that takes in aGraphDataobject and returns a transformed version. The transformation is applied before the first access.transform (
Optional[Callable]) – A function/transform that takes in aGraphDataobject and returns a transformed version. The transformation is applied before every access, i.e., during the__getitem__call. By default, no transformation is applied.
Methods
Attributes
nameName of the dataset
Returns the number of edge classes to predict.
Returns the number of edge features.
Returns the number of graph classes to predict.
Returns the number of graph features.
Returns the number of graphs in the dataset.
num_itemsReturns the number of items in the dataset.
Returns the number of node classes to predict.
Returns the number of node features.
The path where raw files are stored.
raw_pathThe path where raw files are stored.