public interface OutputFactory<T extends Output<T>> extends com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>, Serializable
Output
, which can generate the
appropriate Output subclass, and OutputInfo
subclass.
Must be Configurable
so it can be loaded from an olcut config file.
Modifier and Type | Method and Description |
---|---|
ImmutableOutputInfo<T> |
constructInfoForExternalModel(Map<T,Integer> mapping)
Creates an
ImmutableOutputInfo from the supplied mapping. |
MutableOutputInfo<T> |
generateInfo()
Generates the appropriate
MutableOutputInfo so the
output values can be tracked by a Dataset or other
aggregate. |
<V> T |
generateOutput(V label)
Parses the
V and generates the appropriate Output value. |
default <V> List<T> |
generateOutputs(List<V> inputs)
Generate a list of outputs from the supplied list of inputs.
|
Evaluator<T,? extends Evaluation<T>> |
getEvaluator()
Gets an
Evaluator suitable for measuring performance of predictions for the Output subclass. |
T |
getUnknownOutput()
Returns the singleton unknown output of type T which can be used for prediction time examples.
|
static <T extends Output<T>> |
validateMapping(Map<T,Integer> mapping)
Validates that the mapping can be used as an output info, i.e.
|
<V> T generateOutput(V label)
V
and generates the appropriate Output
value.
Most implementations call toString on the label before parsing it, but this is not required.
V
- The type of the input value.label
- An input value.T
.T getUnknownOutput()
MutableOutputInfo<T> generateInfo()
MutableOutputInfo
so the
output values can be tracked by a Dataset
or other
aggregate.MutableOutputInfo
initialised to zero.ImmutableOutputInfo<T> constructInfoForExternalModel(Map<T,Integer> mapping)
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.
mapping
- The mapping to use.ImmutableOutputInfo
with a single observation of each element.Evaluator<T,? extends Evaluation<T>> getEvaluator()
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.
default <V> List<T> generateOutputs(List<V> inputs)
Makes inputs.size() calls to generateOutput(V)
.
V
- The type of the inputsinputs
- The list to convert.static <T extends Output<T>> void validateMapping(Map<T,Integer> mapping)
T
- The type of the output.mapping
- The mapping to use.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.