Interface OutputFactory<T extends Output<T>>
- All Superinterfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>,Serializable
- All Known Implementing Classes:
AnomalyFactory,ClusteringFactory,LabelFactory,MultiLabelFactory,RegressionFactory
public interface OutputFactory<T extends Output<T>>
extends com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>, Serializable
An interface associated with a specific
Output, which can generate the
appropriate Output subclass, and OutputInfo subclass.
Must be Configurable so it can be loaded from an olcut config file.
-
Method Summary
Modifier and TypeMethodDescriptionconstructInfoForExternalModel(Map<T, Integer> mapping) Creates anImmutableOutputInfofrom the supplied mapping.Generates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.<V> TgenerateOutput(V label) Parses theVand generates the appropriateOutputvalue.generateOutputs(List<V> inputs) Generate a list of outputs from the supplied list of inputs.Evaluator<T, ? extends Evaluation<T>> 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.static <T extends Output<T>>
voidvalidateMapping(Map<T, Integer> mapping) Validates that the mapping can be used as an output info, i.e.Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfigMethods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Method Details
-
generateOutput
Parses theVand generates the appropriateOutputvalue.Most implementations call toString on the label before parsing it, but this is not required.
- Type Parameters:
V- The type of the input value.- Parameters:
label- An input value.- Returns:
- The parsed Output as an instance of
T.
-
getUnknownOutput
T getUnknownOutput()Returns the singleton unknown output of type T which can be used for prediction time examples.- Returns:
- An unknown output.
-
generateInfo
MutableOutputInfo<T> generateInfo()Generates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.- Returns:
- The appropriate subclass of
MutableOutputInfoinitialised to zero.
-
constructInfoForExternalModel
Creates 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.
- Parameters:
mapping- The mapping to use.- Returns:
- The appropriate subclass of
ImmutableOutputInfowith a single observation of each element.
-
getEvaluator
-
generateOutputs
Generate a list of outputs from the supplied list of inputs.Makes inputs.size() calls to
generateOutput(V).- Type Parameters:
V- The type of the inputs- Parameters:
inputs- The list to convert.- Returns:
- A list of outputs.
-
validateMapping
Validates that the mapping can be used as an output info, i.e. that it is dense in the region [0,mapping.size()) - meaning no duplicate ids, each id 0 through mapping.size() is used, and there are no negative ids.- Type Parameters:
T- The type of the output.- Parameters:
mapping- The mapping to use.
-