rxn.metrics.retro_metrics.RetroMetrics

class rxn.metrics.retro_metrics.RetroMetrics(gt_precursors, gt_products, predicted_precursors, predicted_products, predicted_classes=None, gt_mapped_rxns=None, predicted_mapped_rxns=None)[source]

Bases: MetricsCalculator

Class to compute common metrics for retro models, starting from files containing the ground truth and predictions.

Note: all files are expected to be standardized (canonicalized, sorted, etc.).

Parameters
  • gt_precursors (Iterable[str]) –

  • gt_products (Iterable[str]) –

  • predicted_precursors (Iterable[str]) –

  • predicted_products (Iterable[str]) –

  • predicted_classes (Optional[List[str]], default: None) –

  • gt_mapped_rxns (Optional[List[str]], default: None) –

  • predicted_mapped_rxns (Optional[List[str]], default: None) –

__init__(gt_precursors, gt_products, predicted_precursors, predicted_products, predicted_classes=None, gt_mapped_rxns=None, predicted_mapped_rxns=None)[source]
Parameters
  • gt_precursors (Iterable[str]) –

  • gt_products (Iterable[str]) –

  • predicted_precursors (Iterable[str]) –

  • predicted_products (Iterable[str]) –

  • predicted_classes (Optional[List[str]], default: None) –

  • gt_mapped_rxns (Optional[List[str]], default: None) –

  • predicted_mapped_rxns (Optional[List[str]], default: None) –

Methods

__init__(gt_precursors, gt_products, ...[, ...])

param gt_precursors

from_metrics_files(metrics_files)

Build the instance from the MetricsFiles object.

from_raw_files(gt_precursors_file, ...[, ...])

param gt_precursors_file

get_metrics()

Calculate the metrics.

classmethod from_metrics_files(metrics_files)[source]

Build the instance from the MetricsFiles object.

Parameters

metrics_files (MetricsFiles) –

Return type

RetroMetrics

get_metrics()[source]

Calculate the metrics.

Note: the paths to ground truth and prediction are to be set in the constructor of the derived class.

Return type

Dict[str, Any]