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:
ABC
Base dataset class.
download
andprocess
methods must be implemented by children classes. Thesave
andload
methods save and load only the processedself.graphs
attribute by default. You may want to override them to store/load additional processed attributes.Graph data within the dataset should be stored in
self.graphs
as a List[GraphData]. The creation and preprocessing of this list of graphs is typically done within the overriddenprocess
method.- 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/
.transform (
Optional
[Callable
]) – A function/transform that takes in aGraphData
object 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
download
()Download the dataset at self.raw_path.
load
()Load the processed dataset
process
()Process the dataset and store graphs in
self.graphs
save
()Save the processed dataset
Attributes
Name 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.
Returns the number of node classes to predict.
Returns the number of node features.
The path where raw files are stored.
The path where raw files are stored.