Class LabelInfo
java.lang.Object
org.tribuo.classification.LabelInfo
- All Implemented Interfaces:
Serializable,OutputInfo<Label>
- Direct Known Subclasses:
ImmutableLabelInfo,MutableLabelInfo
The base class for information about multi-class classification Labels.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe occurrence counts of each label.The label domain.protected intThe number of unknown labels this LabelInfo has seen. -
Method Summary
Modifier and TypeMethodDescriptionabstract LabelInfocopy()Generates a copy of this OutputInfo, including it's mutability.Generates anImmutableOutputInfowhich has a copy of the data in thisOutputInfo, but also has id values and is immutable.Generates a mutable copy of thisOutputInfo.Returns the set of possibleLabels that this LabelInfo has seen.longgetLabelCount(String label) Gets the count of the supplied label, or 0 if the label is unknown.longgetLabelCount(Label label) Gets the count of the supplied label, or 0 if the label is unknown.intReturns the number of unknownOutputinstances (generated byOutputFactory.getUnknownOutput()) that this OutputInfo has seen.An Iterable over the possible outputs and the number of times they were observed.intsize()The number of uniqueLabels this LabelInfo has seen.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tribuo.OutputInfo
toReadableString
-
Field Details
-
labelCounts
-
unknownCount
protected int unknownCountThe number of unknown labels this LabelInfo has seen. -
labels
-
-
Method Details
-
getUnknownCount
public int getUnknownCount()Description copied from interface:OutputInfoReturns the number of unknownOutputinstances (generated byOutputFactory.getUnknownOutput()) that this OutputInfo has seen.- Specified by:
getUnknownCountin interfaceOutputInfo<Label>- Returns:
- The number of unknown outputs observed.
-
getDomain
-
getLabelCount
Gets the count of the supplied label, or 0 if the label is unknown.- Parameters:
label- A Label.- Returns:
- A non-negative long.
-
getLabelCount
Gets the count of the supplied label, or 0 if the label is unknown.- Parameters:
label- A String representing a Label.- Returns:
- A non-negative long.
-
outputCountsIterable
Description copied from interface:OutputInfoAn 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:
outputCountsIterablein interfaceOutputInfo<Label>- Returns:
- Lambda wrapping an iterator over Pairs.
-
size
public int size()The number of uniqueLabels this LabelInfo has seen.- Specified by:
sizein interfaceOutputInfo<Label>- Returns:
- The number of unique labels.
-
generateImmutableOutputInfo
Description copied from interface:OutputInfoGenerates anImmutableOutputInfowhich has a copy of the data in thisOutputInfo, but also has id values and is immutable.- Specified by:
generateImmutableOutputInfoin interfaceOutputInfo<Label>- Returns:
- An immutable copy of this OutputInfo.
-
generateMutableOutputInfo
Description copied from interface:OutputInfoGenerates a mutable copy of thisOutputInfo.- Specified by:
generateMutableOutputInfoin interfaceOutputInfo<Label>- Returns:
- A mutable copy of this OutputInfo.
-
copy
Description copied from interface:OutputInfoGenerates a copy of this OutputInfo, including it's mutability.- Specified by:
copyin interfaceOutputInfo<Label>- Returns:
- A copy of the OutputInfo.
-