Package org.tribuo

Interface Output<T extends Output<T>>

All Superinterfaces:
ProtoSerializable<org.tribuo.protos.core.OutputProto>, Serializable
All Known Subinterfaces:
Classifiable<T>
All Known Implementing Classes:
ClusterID, Event, Label, MultiLabel, Regressor, Regressor.DimensionTuple

public interface Output<T extends Output<T>> extends ProtoSerializable<org.tribuo.protos.core.OutputProto>, Serializable
Output is the root interface for the supported prediction types.

It's subclassed in each of the modules:

  • Label for multi-class classification
  • MultiLabel for multi-label classification
  • ClusterID for clustering
  • Regressor for regression
  • Event for anomaly detection
Equals and hashcode are defined to only look at the strings stored in an Output, not any score values. For equality that takes into account the scores, use fullEquals(T).
  • Method Details

    • copy

      T copy()
      Deep copy of the output up to its immutable state.
      Returns:
      A copy of the output.
    • getSerializableForm

      String getSerializableForm(boolean includeConfidence)
      Generates a String suitable for writing to a csv or json file.
      Parameters:
      includeConfidence - Include whatever confidence score the label contains, if known.
      Returns:
      A String representation of this Output.
    • fullEquals

      boolean fullEquals(T other)
      Compares other to this output. Uses all score values and the strings.
      Parameters:
      other - Another output instance.
      Returns:
      True if the other instance has value equality to this instance. False otherwise.
    • fullEquals

      default boolean fullEquals(T other, double tolerance)
      Compares other to this output. Uses all score values and the strings.

      The default implementation of this method ignores the tolerance for compatibility reasons, it is overridden in all output classes in Tribuo.

      Parameters:
      other - Another output instance.
      tolerance - The tolerance level for an absolute value comparison.
      Returns:
      True if the other instance has value equality to this instance. False otherwise.
    • deserialize

      static Output<?> deserialize(org.tribuo.protos.core.OutputProto proto)
      Deserializes a OutputProto into a Output subclass.
      Parameters:
      proto - The proto to deserialize.
      Returns:
      The deserialized Output.