MolecularDiffusion.modules.tasks.regression¶
Classes¶
Class for load/save configuration. |
Module Contents¶
- class MolecularDiffusion.modules.tasks.regression.ProperyPrediction(model, task=(), include_charge=False, criterion='mse', metric=('mae', 'rmse'), loss_param=None, num_mlp_layer=1, normalization=True, num_class=None, mlp_batch_norm=False, condition_time=False, readout='mean', mlp_dropout=0, std_mean=None, load_mlps_layer=0, verbose=0)¶
Bases:
MolecularDiffusion.modules.tasks.task.Task,MolecularDiffusion.core.ConfigurableClass for load/save configuration. It will automatically record every argument passed to the
__init__function.This class is inspired by
state_dict()in PyTorch, but designed for hyperparameters.Inherit this class to construct a configurable class.
>>> class MyClass(nn.Module, core.Configurable):
Note
Configurableonly applies to the current class rather than any derived class. For example, the following definition only records the arguments ofMyClass.>>> class DerivedClass(MyClass):
In order to record the arguments of
DerivedClass, explicitly specify the inheritance.>>> class DerivedClass(MyClass, core.Configurable):
To get the configuration of an instance, use
config_dict(), which returns a dict of argument names and values. If an argument is also an instance ofConfigurable, it will be recursively expanded in the dict. The configuration dict can be passed toload_config_dict()to create a copy of the instance.For classes already registered in
Registry, they can be directly created from theConfigurableclass. This is convenient for building models from configuration files.>>> config = models.GCN(128, [128]).config_dict() >>> gcn = Configurable.load_config_dict(config)
- evaluate(pred, target)¶
- forward(batch)¶
- get_adj_matrix(_edges_dict, n_nodes, batch_size)¶
- pad_data(array, batch, dim)¶
” array: torch.Tensor of shape (n_atoms, n_features) batch: pytorch_geometric.data.Batch
- predict(batch, all_loss=None, metric=None, evaluate=False)¶
- preprocess(train_set, valid_set=None, test_set=None)¶
Compute the mean and derivation for each task on the training set.
- readout_f(embeddings: torch.Tensor) torch.Tensor¶
Perform readout operation over nodes in each molecule.
Parameters: - embeddings (torch.Tensor): Tensor of size (x, y, z) where x is the batch size, y is the number of nodes, and z is the feature size.
Returns: torch.Tensor: Aggregated tensor of size (x, z).
- target(batch)¶
- THESHOLD = 4.5¶
- condition_time = False¶
- criterion = 'mse'¶
- eps = 1e-10¶
- include_charge = False¶
- load_mlps_layer = 0¶
- loss_param = None¶
- metric = ('mae', 'rmse')¶
- mlp = None¶
- mlp_batch_norm = False¶
- mlp_dropout = 0¶
- mlp_final = None¶
- model¶
- normalization = True¶
- num_class¶
- num_mlp_layer = 1¶
- readout = 'mean'¶
- std_mean = None¶
- task = ()¶
- verbose = 0¶