Class MultiLabelFactory
java.lang.Object
org.tribuo.multilabel.MultiLabelFactory
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>,Serializable,OutputFactory<MultiLabel>
A factory for generating MultiLabel objects and their associated OutputInfo and Evaluator objects.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MultiLabelThe sentinel unknown multi-label output used to signal there is no ground truth value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconstructInfoForExternalModel(Map<MultiLabel, Integer> mapping) Creates anImmutableOutputInfofrom the supplied mapping.booleanGenerates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.static StringgenerateLabelString(Set<Label> input) <V> MultiLabelgenerateOutput(V label) Parses the MultiLabel value either by toStringing the input and callingMultiLabel.parseString(java.lang.String)or if it's aCollectioniterating over the elements calling toString on each element in turn and usingMultiLabel.parseElement(java.lang.String).Gets anEvaluatorsuitable for measuring performance of predictions for the Output subclass.Returns the singleton unknown output of type T which can be used for prediction time examples.inthashCode()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfigMethods inherited from interface org.tribuo.OutputFactory
generateOutputs
-
Field Details
-
UNKNOWN_MULTILABEL
The sentinel unknown multi-label output used to signal there is no ground truth value.
-
-
Constructor Details
-
MultiLabelFactory
public MultiLabelFactory()Construct a MultiLabelFactory.
-
-
Method Details
-
generateOutput
Parses the MultiLabel value either by toStringing the input and callingMultiLabel.parseString(java.lang.String)or if it's aCollectioniterating over the elements calling toString on each element in turn and usingMultiLabel.parseElement(java.lang.String).- Specified by:
generateOutputin interfaceOutputFactory<MultiLabel>- Type Parameters:
V- The type of the input value.- Parameters:
label- An input value.- Returns:
- A MultiLabel
-
getUnknownOutput
Description copied from interface:OutputFactoryReturns the singleton unknown output of type T which can be used for prediction time examples.- Specified by:
getUnknownOutputin interfaceOutputFactory<MultiLabel>- Returns:
- An unknown output.
-
generateInfo
Description copied from interface:OutputFactoryGenerates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.- Specified by:
generateInfoin interfaceOutputFactory<MultiLabel>- Returns:
- The appropriate subclass of
MutableOutputInfoinitialised to zero.
-
constructInfoForExternalModel
public ImmutableOutputInfo<MultiLabel> constructInfoForExternalModel(Map<MultiLabel, Integer> mapping) Description copied from interface:OutputFactoryCreates anImmutableOutputInfofrom the supplied mapping. Requires that the mapping is dense in the integers [0,mapping.size()) and each mapping is unique.This call is used to import external models, and should not be used for other purposes.
- Specified by:
constructInfoForExternalModelin interfaceOutputFactory<MultiLabel>- Parameters:
mapping- The mapping to use.- Returns:
- The appropriate subclass of
ImmutableOutputInfowith a single observation of each element.
-
getEvaluator
Description copied from interface:OutputFactoryGets anEvaluatorsuitable for measuring performance of predictions for the Output subclass.Evaluatorinstances are thread safe and immutable, and commonly this is a singleton stored in theOutputFactoryimplementation.- Specified by:
getEvaluatorin interfaceOutputFactory<MultiLabel>- Returns:
- An evaluator.
-
hashCode
-
equals
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>
-
generateLabelString
-