Class ImmutableMultiLabelInfo

java.lang.Object
org.tribuo.multilabel.MultiLabelInfo
org.tribuo.multilabel.ImmutableMultiLabelInfo
All Implemented Interfaces:
Serializable, Iterable<com.oracle.labs.mlrg.olcut.util.Pair<Integer, MultiLabel>>, ImmutableOutputInfo<MultiLabel>, OutputInfo<MultiLabel>

public class ImmutableMultiLabelInfo extends MultiLabelInfo implements ImmutableOutputInfo<MultiLabel>
An ImmutableOutputInfo for working with multi-label tasks.
See Also:
  • Method Details

    • getDomain

      public Set<MultiLabel> getDomain()
      Description copied from class: MultiLabelInfo
      Returns a set of MultiLabel, where each has a single Label inside it. The set covers the space of Labels that this MultiLabelInfo has seen.
      Specified by:
      getDomain in interface OutputInfo<MultiLabel>
      Overrides:
      getDomain in class MultiLabelInfo
      Returns:
      The set of possible labels.
    • getID

      public int getID(MultiLabel output)
      Description copied from interface: ImmutableOutputInfo
      Return the id number associated with this output, or -1 if the output is unknown.
      Specified by:
      getID in interface ImmutableOutputInfo<MultiLabel>
      Parameters:
      output - An output
      Returns:
      A non-negative integer if the output is known, or -1 if the output is unknown.
    • getOutput

      public MultiLabel getOutput(int id)
      Description copied from interface: ImmutableOutputInfo
      Returns the output associated with this id, or null if the id is unknown.
      Specified by:
      getOutput in interface ImmutableOutputInfo<MultiLabel>
      Parameters:
      id - A non-negative integer.
      Returns:
      An output object or null if it's unknown.
    • getTotalObservations

      public long getTotalObservations()
      Description copied from interface: ImmutableOutputInfo
      Returns the total number of observed outputs seen by this ImmutableOutputInfo.
      Specified by:
      getTotalObservations in interface ImmutableOutputInfo<MultiLabel>
      Returns:
      The number of observed outputs.
    • getID

      public int getID(String label)
      Gets the id for the supplied label string.
      Parameters:
      label - The label string.
      Returns:
      The id number, or -1 if the label is unknown.
    • getLabelCount

      public long getLabelCount(int id)
      Gets the count of the label occurrence for the specified id number, or 0 if it's unknown.
      Parameters:
      id - The label id.
      Returns:
      The label count.
    • copy

      public ImmutableMultiLabelInfo copy()
      Description copied from interface: OutputInfo
      Generates a copy of this OutputInfo, including it's mutability.
      Specified by:
      copy in interface OutputInfo<MultiLabel>
      Specified by:
      copy in class MultiLabelInfo
      Returns:
      A copy of the OutputInfo.
    • toReadableString

      public String toReadableString()
      Description copied from interface: OutputInfo
      Generates a String form of this OutputInfo.

      This String can contain newlines, tabs and other formatting.

      Specified by:
      toReadableString in interface OutputInfo<MultiLabel>
      Returns:
      A formatted String representing this OutputInfo.
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class MultiLabelInfo
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class MultiLabelInfo
    • iterator

      public Iterator<com.oracle.labs.mlrg.olcut.util.Pair<Integer, MultiLabel>> iterator()
      Specified by:
      iterator in interface Iterable<com.oracle.labs.mlrg.olcut.util.Pair<Integer, MultiLabel>>