public abstract class SkeletalIndependentRegressionTrainer<T> extends Object implements Trainer<Regressor>
Model
s, each of which predicts a single Regressor
.
Generates the SparseVectors once to reduce allocation.
Then wraps it up in an SkeletalIndependentRegressionModel
to provide a Regressor
prediction.
It trains each model sequentially, and could be optimised to train in parallel.
DEFAULT_SEED
Modifier | Constructor and Description |
---|---|
protected |
SkeletalIndependentRegressionTrainer()
for olcut.
|
Modifier and Type | Method and Description |
---|---|
protected abstract SkeletalIndependentRegressionModel |
createModel(Map<String,T> models,
ModelProvenance provenance,
ImmutableFeatureMap featureMap,
ImmutableOutputInfo<Regressor> outputInfo)
Constructs the appropriate subclass of
SkeletalIndependentRegressionModel for this trainer. |
int |
getInvocationCount()
The number of times this trainer instance has had it's train method invoked.
|
protected abstract String |
getModelClassName()
Returns the class name of the model that this class produces.
|
void |
postConfig()
Used by the OLCUT configuration system, and should not be called by external code.
|
SkeletalIndependentRegressionModel |
train(Dataset<Regressor> examples)
Trains a predictive model using the examples in the given data set.
|
SkeletalIndependentRegressionModel |
train(Dataset<Regressor> examples,
Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
Trains a predictive model using the examples in the given data set.
|
protected abstract T |
trainDimension(double[] outputs,
SparseVector[] features,
float[] weights,
SplittableRandom rng)
Trains a single dimension of the possibly multiple dimensions.
|
protected abstract boolean |
useBias()
Returns true if the SparseVector should be constructed with a bias feature.
|
protected SkeletalIndependentRegressionTrainer()
public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
public SkeletalIndependentRegressionModel train(Dataset<Regressor> examples)
Trainer
public SkeletalIndependentRegressionModel train(Dataset<Regressor> examples, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
Trainer
public int getInvocationCount()
Trainer
This is used to determine how many times the trainer's RNG has been accessed to ensure replicability in the random number stream.
getInvocationCount
in interface Trainer<Regressor>
protected abstract SkeletalIndependentRegressionModel createModel(Map<String,T> models, ModelProvenance provenance, ImmutableFeatureMap featureMap, ImmutableOutputInfo<Regressor> outputInfo)
SkeletalIndependentRegressionModel
for this trainer.models
- The models to use.provenance
- The model provenancefeatureMap
- The feature map.outputInfo
- The regression info.protected abstract T trainDimension(double[] outputs, SparseVector[] features, float[] weights, SplittableRandom rng)
outputs
- The regression targets for this dimension.features
- The features.weights
- The example weights.rng
- The RNG to use.createModel(java.util.Map<java.lang.String, T>, org.tribuo.provenance.ModelProvenance, org.tribuo.ImmutableFeatureMap, org.tribuo.ImmutableOutputInfo<org.tribuo.regression.Regressor>)
.protected abstract boolean useBias()
protected abstract String getModelClassName()
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.