torchdrug.metrics

Basic Metrics

AUROC

area_under_roc(pred, target)[source]

Area under receiver operating characteristic curve (ROC).

Parameters
  • pred (Tensor) – predictions of shape \((n,)\)

  • target (Tensor) – binary targets of shape \((n,)\)

AUROC()

alias of torchdrug.metrics.area_under_roc

AUPRC

area_under_prc(pred, target)[source]

Area under precision-recall curve (PRC).

Parameters
  • pred (Tensor) – predictions of shape \((n,)\)

  • target (Tensor) – binary targets of shape \((n,)\)

AUPRC()

alias of torchdrug.metrics.area_under_prc

R2

r2(pred, target)[source]

\(R^2\) regression score.

Parameters
  • pred (Tensor) – predictions of shape \((n,)\)

  • target (Tensor) – targets of shape \((n,)\)

Variadic Accuracy

variadic_accuracy(input, target, size)[source]

Compute classification accuracy over variadic sizes of categories.

Suppose there are \(N\) samples, and the number of categories in all samples is summed to :math`B`.

Parameters
  • input (Tensor) – prediction of shape \((B,)\)

  • target (Tensor) – target of shape \((N,)\). Each target is a relative index in a sample.

  • size (Tensor) – number of categories of shape \((N,)\)

Chemical Metrics

SA

SA(pred)[source]

Synthetic accesibility score.

Parameters

pred (PackedMolecule) – molecules to evaluate

QED

QED(pred)[source]

Quantitative estimation of drug-likeness.

Parameters

pred (PackedMolecule) – molecules to evaluate

Chemical Validity

chemical_validity(pred)[source]

Chemical validity of molecules.

Parameters

pred (PackedMolecule) – molecules to evaluate

LogP

logP(pred)[source]

Logarithm of partition coefficient between octanol and water for a compound.

Parameters

pred (PackedMolecule) – molecules to evaluate

Penalized LogP

penalized_logP(pred)[source]

Logarithm of partition coefficient, penalized by cycle length and synthetic accessibility.

Parameters

pred (PackedMolecule) – molecules to evaluate