MultipleDipoleTarget

model openff.nagl.training.loss.MultipleDipoleTarget[source]

A target that is evaluated on the dipole of a molecule.

Fields:
field charge_label: str [Required]
field conformation_column: str [Required]
field n_conformation_column: str [Required]
field name: Literal['multiple_dipoles'] = 'multiple_dipoles'
evaluate_target(molecules: DGLMolecule | DGLMoleculeBatch, labels: Dict[str, Tensor], predictions: Dict[str, Tensor], readout_modules: Dict[str, ReadoutModule]) Tensor[source]

Evaluate the target property for a molecule or batch of molecules. This does not need to account for the denominator and weight, which will be factored in evaluate.

Parameters:
  • molecules (DGLMolecule or DGLMoleculeBatch) – The molecule(s) to evaluate the target for.

  • labels (Dict[str, torch.Tensor]) – The labels for the molecule(s). If molecules is a batch, the values of these will be contiguous arrays, which should be split for molecular-based errors

  • predictions (Dict[str, torch.Tensor]) – The predictions for the molecule(s). If molecules is a batch, the values of these will be contiguous arrays, which should be split for molecular-based errors

Returns:

torch.Tensor – The loss for the molecule(s).

get_required_columns() List[str][source]

Target columns used in this target.

This method is used to determine which columns to extract from the parquet datasets.

report_artifact(molecules: DGLMolecule | DGLMoleculeBatch, labels: Dict[str, Tensor], predictions: Dict[str, Tensor], output_directory: Path, top_n_entries: int = 100, bottom_n_entries: int = 100) Path[source]

Create a report of artifacts for this target for an MLFlowLogger.

Parameters:
  • molecules (DGLMolecule or DGLMoleculeBatch) – The molecule(s) to evaluate the target for.

  • labels (Dict[str, torch.Tensor]) – The labels for the molecule(s). If molecules is a batch, the values of these will be contiguous arrays, which should be split for molecular-based errors

  • predictions (Dict[str, torch.Tensor]) – The predictions for the molecule(s). If molecules is a batch, the values of these will be contiguous arrays, which should be split for molecular-based errors

  • output_directory (pathlib.Path) – The directory to output the report to.

  • top_n_entries (int, optional) – The number of top-ranked entries to include in the report.

  • bottom_n_entries (int, optional) – The number of bottom-ranked entries to include in the report.

Returns:

pathlib.Path – The path to the report.