olorenchemengine.external.ChemProp package#

Submodules#

olorenchemengine.external.ChemProp.main module#

Wraps the model presented in Analyzing Learned Molecular Representations for Property Prediction <hhttps://doi.org/10.1021/acs.jcim.9b00237>. Here, we adapt its PyTorch Geometric implementation as in the Github repository <https://github.com/itakigawa/pyg_chemprop>

class olorenchemengine.external.ChemProp.main.ChemPropDataLoading#

Bases: TorchGeometricGraph

class olorenchemengine.external.ChemProp.main.ChemPropModel(dropout_rate: float = 0.0, epochs: int = 3, batch_size: int = 50, lr: float = 0.001, hidden_size: int = 300, depth: int = 3, **kwargs)#

Bases: BaseModel

ChemProp is the model presented in Analyzing Learned Molecular Representations for Property Prediction <hhttps://doi.org/10.1021/acs.jcim.9b00237> _. Here, we adapt its PyTorch Geometric implementation as in the Github repository

“ChemProp” is a simple but effective Graph Neural Network (GNN) for Molecular Property Prediction. The PyG implementation makes it compatible with Oloren AI software.

representation#

Returns smiles-inputted data as PyTorch graph objects for use in the ChemProp model

Type:

TorchGeometricGraph

setting#

whether the model is a “classification” model or a “regression” model

Type:

str

optimizer#

function to modify model parameters such as weights and learning rate; we use Adam.

criterion#

loss function; we use BCEWithLogitsLoss for classification and MSELoss for regression.

scheduler#

reduces LR as number of training epochs increases; we use PyTorch’s OneCycleLR.

Parameters:
  • dropout_rate (float) – fraction of layer outputs that are randomly ignored; default = 0.

  • epochs (int) – number of complete passes of the training dataset through the model; default = 3.

  • batch_size (int) – number of training examples utilized in one model iteration; default = 50.

  • lr (float) – amount that the weights are updated during training; default = 1e-3.

  • hidden_size (int) – number of hidden neurons between input and output; default = 300.

  • depth (int) – number of layers between input and output; default = 3.

preprocess(X, y, **kwargs)#
Parameters:

X (list of smiles) –

Returns:

Processed list converted into whatever input for the model

class olorenchemengine.external.ChemProp.main.ChemProp_AF(log=True)#

Bases: AtomFeaturizer

convert(atom: _MockObject.Chem.Atom) _MockObject.ndarray#
property length#
class olorenchemengine.external.ChemProp.main.ChemProp_BF(log=True)#

Bases: BondFeaturizer

convert(bond: _MockObject.Chem.Bond) _MockObject.ndarray#
property length#
olorenchemengine.external.ChemProp.main.aggregate_at_nodes(num_nodes, message, edge_index)#
olorenchemengine.external.ChemProp.main.directed_mp(message, edge_index, revedge_index)#
olorenchemengine.external.ChemProp.main.initialize_weights(model: <MagicMock name='mock.nn.Module' id='140680894330192'>) None#

Initializes the weights of a model in place. :param model: An PyTorch model.

olorenchemengine.external.ChemProp.main.onek_encoding_unk(value, choices)#
olorenchemengine.external.ChemProp.main.predict(config, loader, setting='classification')#
olorenchemengine.external.ChemProp.main.train(config, loader, setting)#

Module contents#