Class MultiLabelInfo

java.lang.Object
org.tribuo.multilabel.MultiLabelInfo
All Implemented Interfaces:
Serializable, OutputInfo<MultiLabel>, ProtoSerializable<org.tribuo.protos.core.OutputDomainProto>
Direct Known Subclasses:
ImmutableMultiLabelInfo, MutableMultiLabelInfo

public abstract class MultiLabelInfo extends Object implements OutputInfo<MultiLabel>
The base class for information about MultiLabel outputs.
See Also:
  • Field Details

    • labelCounts

      protected final Map<String,com.oracle.labs.mlrg.olcut.util.MutableLong> labelCounts
      The map of label occurrence counts.
    • unknownCount

      protected int unknownCount
      The number of times the unknown label has been observed.
    • labels

      protected transient Map<String,MultiLabel> labels
      The label domain.
    • totalCount

      protected int totalCount
      The total number of MultiLabel objects this object has seen.
  • Method Details

    • getUnknownCount

      public int getUnknownCount()
      Description copied from interface: OutputInfo
      Returns the number of unknown Output instances (generated by OutputFactory.getUnknownOutput()) that this OutputInfo has seen.
      Specified by:
      getUnknownCount in interface OutputInfo<MultiLabel>
      Returns:
      The number of unknown outputs observed.
    • getDomain

      public Set<MultiLabel> getDomain()
      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>
      Returns:
      The set of possible labels.
    • getLabelCount

      public long getLabelCount(Label label)
      Get the number of times this Label was observed, or 0 if unknown.
      Parameters:
      label - The Label to look for.
      Returns:
      A non-negative long.
    • getLabelCount

      public long getLabelCount(String label)
      Get the number of times this String was observed, or 0 if unknown.
      Parameters:
      label - The String to look for.
      Returns:
      A non-negative long.
    • outputCountsIterable

      public Iterable<com.oracle.labs.mlrg.olcut.util.Pair<String,Long>> outputCountsIterable()
      Description copied from interface: OutputInfo
      An Iterable over the possible outputs and the number of times they were observed.

      Provides similar functionality to an iterator over the entrySet of a Map, though this is a copy of the data and immutable.

      Specified by:
      outputCountsIterable in interface OutputInfo<MultiLabel>
      Returns:
      Lambda wrapping an iterator over Pairs.
    • size

      public int size()
      Description copied from interface: OutputInfo
      Returns the number of possible values this OutputInfo knows about.

      For real values this is the number of dimensions observed.

      Specified by:
      size in interface OutputInfo<MultiLabel>
      Returns:
      An int representing the size of the domain.
    • generateImmutableOutputInfo

      public ImmutableOutputInfo<MultiLabel> generateImmutableOutputInfo()
      Description copied from interface: OutputInfo
      Generates an ImmutableOutputInfo which has a copy of the data in this OutputInfo, but also has id values and is immutable.
      Specified by:
      generateImmutableOutputInfo in interface OutputInfo<MultiLabel>
      Returns:
      An immutable copy of this OutputInfo.
    • generateMutableOutputInfo

      public MutableOutputInfo<MultiLabel> generateMutableOutputInfo()
      Description copied from interface: OutputInfo
      Generates a mutable copy of this OutputInfo.
      Specified by:
      generateMutableOutputInfo in interface OutputInfo<MultiLabel>
      Returns:
      A mutable copy of this OutputInfo.
    • copy

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object