-
split_train_test — This function splits a torch dataset into train and val dataset. As torch Dataset class is a mother class of pytorch_geometric dataset class, it should work just fine for the latter.
qek.data.training_data
module
qek.data.training_data
Manipulating training data
Functions
split_train_test
(dataset: torch_data.Dataset, lengths: list[float], seed: int | None = None) → tuple[torch_data.Dataset, torch_data.Dataset]
This function splits a torch dataset into train and val dataset.
As torch Dataset class is a mother class of pytorch_geometric dataset
class, it should work just fine for the latter.
Parameters
-
dataset : torch_data.Dataset — The original dataset to be splitted
-
lengths : list[float] — Percentage of the split. For instance [0.8, 0.2]
-
seed : int | None, optional — Seed for reproductibility. Defaults to
-
None.
Returns
-
tuple[torch_data.Dataset, torch_data.Dataset] — train and val dataset