Class ClassificationResult<T>

java.lang.Object
com.groiss.ml.classifier.ClassificationResult<T>

public class ClassificationResult<T> extends Object
Represents the label of a classification prediction along with the probability of that prediction. If no such probability is provided UNKNOWN_PROBABILITY will be returned as default.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Determines that no probability is available for this classification result
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new classification result with the passed label and an unknown probability
    ClassificationResult(T label, double probability)
    Creates a new classification result with the passed label and probability
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the label of the classification
    double
    Returns the probability of the prediction
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • UNKNOWN_PROBABILITY

      public static final double UNKNOWN_PROBABILITY
      Determines that no probability is available for this classification result
      See Also:
  • Constructor Details

    • ClassificationResult

      public ClassificationResult(T label)
      Creates a new classification result with the passed label and an unknown probability
      Parameters:
      label - the label of this classification
    • ClassificationResult

      public ClassificationResult(T label, double probability)
      Creates a new classification result with the passed label and probability
      Parameters:
      label - the label of this classification
      probability - the probability of the prediction. Must be either UNKNOWN_PROBABILITY or a value ≥ 0 and ≤ 1.
  • Method Details

    • label

      public T label()
      Returns the label of the classification
      Returns:
      the label of the classification
    • probability

      public double probability()
      Returns the probability of the prediction
      Returns:
      the probability of the prediction
    • toString

      public String toString()
      Overrides:
      toString in class Object