Class Label

java.lang.Object
org.tribuo.classification.Label
All Implemented Interfaces:
Serializable, Classifiable<Label>, Output<Label>

public final class Label extends Object implements Classifiable<Label>
An immutable multi-class classification label.

The labels themselves are Strings. A Label also contains an optional score which measures the confidence in that label, though it is not required to be a probability.

Label equality and hashCode is defined solely on the String label, it does not take into account the score.

See Also:
  • Field Details

    • UNKNOWN

      public static final String UNKNOWN
      The name of the unknown label (i.e., an unlabelled output).
      See Also:
    • label

      protected final String label
      The name of the label.
    • score

      protected final double score
      The score of the label.
  • Constructor Details

    • Label

      public Label(String label, double score)
      Builds a label with the supplied string and score.
      Parameters:
      label - The label name.
      score - The label instance score.
    • Label

      public Label(String label)
      Builds a label with the sentinel score of Double.NaN.
      Parameters:
      label - The name of this label.
  • Method Details