Interface Metric

All Known Implementing Classes:
Accuracy, Precision, Recall

public interface Metric
The class metrics keeps track of metric states, which enables them to be able to calculate values through accumulations and synchronizations across multiple processes.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Computes the metric value from the metric state, which are updated by previous update() calls.
    Returns the name of metric.
    void
    Resets the metric state variables to their default value.
    void
    update(Tensor output, Tensor target)
    Updates the metric states with input data.
  • Method Details

    • name

      String name()
      Returns the name of metric.
      Returns:
      the name of metric.
    • update

      void update(Tensor output, Tensor target)
      Updates the metric states with input data. This is often used when new data needs to be added for metric computation.
      Parameters:
      output - the model output.
      target - the ground truth.
    • compute

      double compute()
      Computes the metric value from the metric state, which are updated by previous update() calls. The compute frequency can be less than the update frequency.
      Returns:
      the metric value.
    • reset

      void reset()
      Resets the metric state variables to their default value. Usually this is called at the end of every epoch to clean up metric states.