Package org.tribuo.classification
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
Modifier and TypeFieldDescriptionThe occurrence counts of each label.The label domain.protected int
The number of unknown labels this LabelInfo has seen. -
Method Summary
Modifier and TypeMethodDescriptionabstract LabelInfo
copy()
Generates a copy of this OutputInfo, including it's mutability.Generates anImmutableOutputInfo
which 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 possibleLabel
s that this LabelInfo has seen.long
getLabelCount
(String label) Gets the count of the supplied label, or 0 if the label is unknown.long
getLabelCount
(Label label) Gets the count of the supplied label, or 0 if the label is unknown.int
Returns the number of unknownOutput
instances (generated byOutputFactory.getUnknownOutput()
) that this OutputInfo has seen.An Iterable over the possible outputs and the number of times they were observed.int
size()
The number of uniqueLabel
s this LabelInfo has seen.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tribuo.OutputInfo
toReadableString
-
Field Details
-
labelCounts
The occurrence counts of each label. -
unknownCount
protected int unknownCountThe number of unknown labels this LabelInfo has seen. -
labels
The label domain.
-
-
Method Details
-
getUnknownCount
public int getUnknownCount()Description copied from interface:OutputInfo
Returns the number of unknownOutput
instances (generated byOutputFactory.getUnknownOutput()
) that this OutputInfo has seen.- Specified by:
getUnknownCount
in interfaceOutputInfo<Label>
- Returns:
- The number of unknown outputs observed.
-
getDomain
Returns the set of possibleLabel
s that this LabelInfo has seen.Each label has the default score of Double.NaN.
- Specified by:
getDomain
in interfaceOutputInfo<Label>
- Returns:
- The set of possible labels.
-
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: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 interfaceOutputInfo<Label>
- Returns:
- Lambda wrapping an iterator over Pairs.
-
size
public int size()The number of uniqueLabel
s this LabelInfo has seen.- Specified by:
size
in interfaceOutputInfo<Label>
- Returns:
- The number of unique labels.
-
generateImmutableOutputInfo
Description copied from interface:OutputInfo
Generates anImmutableOutputInfo
which has a copy of the data in thisOutputInfo
, but also has id values and is immutable.- Specified by:
generateImmutableOutputInfo
in interfaceOutputInfo<Label>
- Returns:
- An immutable copy of this OutputInfo.
-
generateMutableOutputInfo
Description copied from interface:OutputInfo
Generates a mutable copy of thisOutputInfo
.- Specified by:
generateMutableOutputInfo
in interfaceOutputInfo<Label>
- Returns:
- A mutable copy of this OutputInfo.
-
copy
Description copied from interface:OutputInfo
Generates a copy of this OutputInfo, including it's mutability.- Specified by:
copy
in interfaceOutputInfo<Label>
- Returns:
- A copy of the OutputInfo.
-