Package org.tribuo.multilabel
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
The base class for information about
MultiLabel
outputs.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionThe map of label occurrence counts.protected Map<String,
MultiLabel> The label domain.protected int
The total number ofMultiLabel
objects this object has seen.protected int
The number of times the unknown label has been observed.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Method Summary
Modifier and TypeMethodDescriptionabstract MultiLabelInfo
copy()
Generates a copy of this OutputInfo, including it's mutability.boolean
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 a set of MultiLabel, where each has a single Label inside it.long
getLabelCount
(String label) Get the number of times this String was observed, or 0 if unknown.long
getLabelCount
(Label label) Get the number of times this Label was observed, or 0 if unknown.int
Returns the number of unknownOutput
instances (generated byOutputFactory.getUnknownOutput()
) that this OutputInfo has seen.int
hashCode()
An Iterable over the possible outputs and the number of times they were observed.int
size()
Returns the number of possible values this OutputInfo knows about.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tribuo.OutputInfo
toReadableString
Methods inherited from interface org.tribuo.protos.ProtoSerializable
serialize
-
Field Details
-
labelCounts
The map of label occurrence counts. -
unknownCount
protected int unknownCountThe number of times the unknown label has been observed. -
labels
The label domain. -
totalCount
protected int totalCountThe total number ofMultiLabel
objects this object has seen.
-
-
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<MultiLabel>
- Returns:
- The number of unknown outputs observed.
-
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 interfaceOutputInfo<MultiLabel>
- Returns:
- The set of possible labels.
-
getLabelCount
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
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
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<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 interfaceOutputInfo<MultiLabel>
- Returns:
- An int representing the size of the domain.
-
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<MultiLabel>
- Returns:
- An immutable copy of this OutputInfo.
-
generateMutableOutputInfo
Description copied from interface:OutputInfo
Generates a mutable copy of thisOutputInfo
.- Specified by:
generateMutableOutputInfo
in interfaceOutputInfo<MultiLabel>
- 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<MultiLabel>
- Returns:
- A copy of the OutputInfo.
-
equals
-
hashCode
public int hashCode()
-