public final class LabelFactory extends Object implements OutputFactory<Label>
Parses the Label by calling toString on the input.
Label factories have no state, and are all equal to each other.
Modifier and Type | Class and Description |
---|---|
static class |
LabelFactory.LabelFactoryProvenance
Provenance for
LabelFactory . |
Modifier and Type | Field and Description |
---|---|
static Label |
UNKNOWN_LABEL
The singleton unknown label, used for unlablled examples.
|
Constructor and Description |
---|
LabelFactory()
Constructs a label factory.
|
Modifier and Type | Method and Description |
---|---|
ImmutableOutputInfo<Label> |
constructInfoForExternalModel(Map<Label,Integer> mapping)
Creates an
ImmutableOutputInfo from the supplied mapping. |
boolean |
equals(Object obj) |
MutableOutputInfo<Label> |
generateInfo()
Generates an empty MutableLabelInfo.
|
<V> Label |
generateOutput(V label)
Generates the Label string by calling toString
on the input.
|
Evaluator<Label,LabelEvaluation> |
getEvaluator()
Gets an
Evaluator suitable for measuring performance of predictions for the Output subclass. |
OutputFactoryProvenance |
getProvenance() |
Label |
getUnknownOutput()
Returns the singleton unknown output of type T which can be used for prediction time examples.
|
int |
hashCode() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
generateOutputs, validateMapping
public static final Label UNKNOWN_LABEL
public <V> Label generateOutput(V label)
generateOutput
in interface OutputFactory<Label>
V
- The type of the input.label
- An input value.public Label getUnknownOutput()
OutputFactory
getUnknownOutput
in interface OutputFactory<Label>
public MutableOutputInfo<Label> generateInfo()
generateInfo
in interface OutputFactory<Label>
public ImmutableOutputInfo<Label> constructInfoForExternalModel(Map<Label,Integer> mapping)
OutputFactory
ImmutableOutputInfo
from 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.
constructInfoForExternalModel
in interface OutputFactory<Label>
mapping
- The mapping to use.ImmutableOutputInfo
with a single observation of each element.public Evaluator<Label,LabelEvaluation> getEvaluator()
OutputFactory
Evaluator
suitable for measuring performance of predictions for the Output subclass.
Evaluator
instances are thread safe and immutable, and commonly this is a singleton
stored in the OutputFactory
implementation.
getEvaluator
in interface OutputFactory<Label>
public OutputFactoryProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.