Class Precision

java.lang.Object
smile.deep.metric.Precision
All Implemented Interfaces:
Metric

public class Precision extends Object implements Metric
The precision or positive predictive value (PPV) is ratio of true positives to combined true and false positives, which is different from sensitivity.
     PPV = TP / (TP + FP)
 
  • Constructor Details

    • Precision

      public Precision()
      Constructor.
    • Precision

      public Precision(double threshold)
      Constructor.
      Parameters:
      threshold - The threshold for converting input into binary labels.
    • Precision

      public Precision(Averaging strategy)
      Constructor.
      Parameters:
      strategy - The aggregating strategy for multi-classes.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • name

      public String name()
      Description copied from interface: Metric
      Returns the name of metric.
      Specified by:
      name in interface Metric
      Returns:
      the name of metric.
    • update

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

      public double compute()
      Description copied from interface: Metric
      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.
      Specified by:
      compute in interface Metric
      Returns:
      the metric value.
    • reset

      public void reset()
      Description copied from interface: Metric
      Resets the metric state variables to their default value. Usually this is called at the end of every epoch to clean up metric states.
      Specified by:
      reset in interface Metric