public final class RegressionFactory extends Object implements OutputFactory<Regressor>
Regressor
s and RegressionInfo
s.
It parses the regression dimensions by toStringing the input and calling Regressor.parseString(java.lang.String)
, unless
the input is a collection, in which case it extracts the elements.
This OutputFactory has mutable state, namely the character which the dimension input is split on.
In most cases the default DEFAULT_SPLIT_CHAR
is fine.
Modifier and Type | Class and Description |
---|---|
static class |
RegressionFactory.RegressionFactoryProvenance
Provenance for
RegressionFactory . |
Modifier and Type | Field and Description |
---|---|
static char |
DEFAULT_SPLIT_CHAR
The default character to split the string form of a multidimensional regressor.
|
static Regressor |
UNKNOWN_MULTIPLE_REGRESSOR
Deprecated.
Deprecated when regression was made multidimensional by default.
Use
UNKNOWN_REGRESSOR instead. |
static Regressor |
UNKNOWN_REGRESSOR
The sentinel unknown regressor, used when there is no ground truth regressor value.
|
Constructor and Description |
---|
RegressionFactory()
Builds a regression factory using the default split character
DEFAULT_SPLIT_CHAR . |
RegressionFactory(char splitChar)
Sets the split character used to parse
Regressor instances from Strings. |
Modifier and Type | Method and Description |
---|---|
ImmutableOutputInfo<Regressor> |
constructInfoForExternalModel(Map<Regressor,Integer> mapping)
Creates an
ImmutableOutputInfo from the supplied mapping. |
boolean |
equals(Object obj) |
MutableOutputInfo<Regressor> |
generateInfo()
Generates the appropriate
MutableOutputInfo so the
output values can be tracked by a Dataset or other
aggregate. |
<V> Regressor |
generateOutput(V label)
Parses the Regressor value either by toStringing the input and calling
Regressor.parseString(java.lang.String)
or if it's a collection iterating over the elements calling toString on each element in turn and using
Regressor.parseElement(int, java.lang.String) . |
Evaluator<Regressor,RegressionEvaluation> |
getEvaluator()
Gets an
Evaluator suitable for measuring performance of predictions for the Output subclass. |
OutputFactoryProvenance |
getProvenance() |
Regressor |
getUnknownOutput()
Returns the singleton unknown output of type T which can be used for prediction time examples.
|
int |
hashCode() |
void |
postConfig()
Used by the OLCUT configuration system, and should not be called by external code.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
generateOutputs, validateMapping
public static final char DEFAULT_SPLIT_CHAR
public static final Regressor UNKNOWN_REGRESSOR
@Deprecated public static final Regressor UNKNOWN_MULTIPLE_REGRESSOR
UNKNOWN_REGRESSOR
instead.public RegressionFactory()
DEFAULT_SPLIT_CHAR
.public RegressionFactory(char splitChar)
Regressor
instances from Strings.splitChar
- The split character.public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
public <V> Regressor generateOutput(V label)
Regressor.parseString(java.lang.String)
or if it's a collection iterating over the elements calling toString on each element in turn and using
Regressor.parseElement(int, java.lang.String)
.generateOutput
in interface OutputFactory<Regressor>
V
- The type of the input value.label
- An input value.public Regressor getUnknownOutput()
OutputFactory
getUnknownOutput
in interface OutputFactory<Regressor>
public MutableOutputInfo<Regressor> generateInfo()
OutputFactory
MutableOutputInfo
so the
output values can be tracked by a Dataset
or other
aggregate.generateInfo
in interface OutputFactory<Regressor>
MutableOutputInfo
initialised to zero.public ImmutableOutputInfo<Regressor> constructInfoForExternalModel(Map<Regressor,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<Regressor>
mapping
- The mapping to use.ImmutableOutputInfo
with a single observation of each element.public Evaluator<Regressor,RegressionEvaluation> 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<Regressor>
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.