graphchem.data.MoleculeDataset
Bases: Dataset
A custom dataset class for molecular graphs.
This class extends the Dataset class from PyTorch Geometric to create a
dataset of molecular graphs. Each graph in the dataset is an instance of
MoleculeGraph.
Attributes
_graphs : List[MoleculeGraph] A list containing all the molecule graphs in the dataset.
Source code in graphchem/data/structs.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__(graphs)
Initialize the MoleculeDataset object.
Parameters
graphs : Iterable[MoleculeGraph]
An iterable of MoleculeGraph instances representing the
molecules in the dataset.
Source code in graphchem/data/structs.py
83 84 85 86 87 88 89 90 91 92 93 94 95 | |
get(idx)
Retrieves a molecule graph from the dataset by index.
Returns
MoleculeGraph The molecule graph at the specified index.
Source code in graphchem/data/structs.py
108 109 110 111 112 113 114 115 116 117 | |
len()
Returns the number of molecules in the dataset.
Returns
int The number of molecule graphs in the dataset.
Source code in graphchem/data/structs.py
97 98 99 100 101 102 103 104 105 106 | |