Class ImmutableLabelInfo
java.lang.Object
org.tribuo.classification.LabelInfo
org.tribuo.classification.ImmutableLabelInfo
- All Implemented Interfaces:
Serializable,Iterable<com.oracle.labs.mlrg.olcut.util.Pair<Integer,,Label>> ImmutableOutputInfo<Label>,OutputInfo<Label>
An
ImmutableOutputInfo object for Labels.
Gives each unique label an id number. Also counts each label occurrence like MutableLabelInfo does,
though the counts are frozen in this object.
- See Also:
-
Field Summary
Fields inherited from class org.tribuo.classification.LabelInfo
labelCounts, labels, unknownCount -
Method Summary
Modifier and TypeMethodDescriptioncopy()Generates a copy of this OutputInfo, including it's mutability.booleanChecks if the domain is the same as the other output info's domain, and that each element is mapped to the same id number.Returns the set of possibleLabels that this LabelInfo has seen.intReturn the id number associated with this output, or -1 if the output is unknown.longgetLabelCount(int id) Returns the number of times the supplied id was observed before this LabelInfo was frozen.getOutput(int id) Returns the output associated with this id, or null if the id is unknown.longReturns the total number of observed outputs seen by this ImmutableOutputInfo.iterator()Generates a String form of this OutputInfo.toString()Methods inherited from class org.tribuo.classification.LabelInfo
generateImmutableOutputInfo, generateMutableOutputInfo, getLabelCount, getLabelCount, getUnknownCount, outputCountsIterable, sizeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.tribuo.OutputInfo
generateImmutableOutputInfo, generateMutableOutputInfo, getUnknownCount, outputCountsIterable, size
-
Method Details
-
getDomain
-
getID
Description copied from interface:ImmutableOutputInfoReturn the id number associated with this output, or -1 if the output is unknown.- Specified by:
getIDin interfaceImmutableOutputInfo<Label>- Parameters:
output- An output- Returns:
- A non-negative integer if the output is known, or -1 if the output is unknown.
-
getOutput
Description copied from interface:ImmutableOutputInfoReturns the output associated with this id, or null if the id is unknown.- Specified by:
getOutputin interfaceImmutableOutputInfo<Label>- Parameters:
id- A non-negative integer.- Returns:
- An output object or null if it's unknown.
-
getTotalObservations
public long getTotalObservations()Description copied from interface:ImmutableOutputInfoReturns the total number of observed outputs seen by this ImmutableOutputInfo.- Specified by:
getTotalObservationsin interfaceImmutableOutputInfo<Label>- Returns:
- The number of observed outputs.
-
getLabelCount
public long getLabelCount(int id) Returns the number of times the supplied id was observed before this LabelInfo was frozen.- Parameters:
id- The id number.- Returns:
- The count.
-
copy
Description copied from interface:OutputInfoGenerates a copy of this OutputInfo, including it's mutability.- Specified by:
copyin interfaceOutputInfo<Label>- Specified by:
copyin classLabelInfo- Returns:
- A copy of the OutputInfo.
-
toReadableString
Description copied from interface:OutputInfoGenerates a String form of this OutputInfo.This String can contain newlines, tabs and other formatting.
- Specified by:
toReadableStringin interfaceOutputInfo<Label>- Returns:
- A formatted String representing this OutputInfo.
-
toString
-
iterator
-
domainAndIDEquals
Description copied from interface:ImmutableOutputInfoChecks if the domain is the same as the other output info's domain, and that each element is mapped to the same id number.Note the default behaviour will be removed in a future major release, and should be overridden for performance reasons in all implementing classes.
- Specified by:
domainAndIDEqualsin interfaceImmutableOutputInfo<Label>- Parameters:
other- The output info to compare.- Returns:
- True if the domains and ids are the same.
-