Class MetricContext<T extends Output<T>>

java.lang.Object
org.tribuo.evaluation.metrics.MetricContext<T>
Direct Known Subclasses:
LabelMetric.Context

public abstract class MetricContext<T extends Output<T>> extends Object
The context for a metric or set of metrics. At minimum the model used to generate the predictions, and the predictions themselves.
  • Constructor Details

    • MetricContext

      protected MetricContext(Model<T> model, List<Prediction<T>> predictions)
      Constructs a metric context.
      Parameters:
      model - The model.
      predictions - The model's predictions.
    • MetricContext

      protected MetricContext(SequenceModel<T> model, List<Prediction<T>> predictions)
      Constructs a metric context for a sequence model.
      Parameters:
      model - The model.
      predictions - The model's predictions.
  • Method Details

    • getModel

      public Model<T> getModel()
      Gets the Model used by this context.
      Returns:
      The model, or null if this MetricContext operates on a SequenceModel.
    • getSequenceModel

      public SequenceModel<T> getSequenceModel()
      Gets the SequenceModel used by this context.
      Returns:
      The model, or null if this MetricContext operates on a Model.
    • getPredictions

      public List<Prediction<T>> getPredictions()
      Gets the predictions used by this context.
      Returns:
      The predictions.