rxn.metrics.context_metrics.ContextMetrics

class rxn.metrics.context_metrics.ContextMetrics(gt_tgt, predicted_context)[source]

Bases: MetricsCalculator

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

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

Parameters
  • gt_tgt (Iterable[str]) –

  • predicted_context (Iterable[str]) –

__init__(gt_tgt, predicted_context)[source]
Parameters
  • gt_tgt (Iterable[str]) –

  • predicted_context (Iterable[str]) –

Methods

__init__(gt_tgt, predicted_context)

param gt_tgt

from_metrics_files(metrics_files)

Build the instance from the MetricsFiles object.

from_raw_files(gt_tgt_file, ...)

param gt_tgt_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

ContextMetrics

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]