public abstract class SkeletalIndependentRegressionSparseTrainer<T> extends Object implements SparseTrainer<Regressor>
Then wraps them in an SkeletalIndependentRegressionSparseModel
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 |
SkeletalIndependentRegressionSparseTrainer()
for olcut.
|
Modifier and Type | Method and Description |
---|---|
protected abstract SkeletalIndependentRegressionSparseModel |
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.
|
SkeletalIndependentRegressionSparseModel |
train(Dataset<Regressor> examples)
Trains a sparse predictive model using the examples in the given data set.
|
SkeletalIndependentRegressionSparseModel |
train(Dataset<Regressor> examples,
Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
Trains a sparse 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 SkeletalIndependentRegressionSparseTrainer()
public void postConfig()
postConfig
in interface com.oracle.labs.mlrg.olcut.config.Configurable
public SkeletalIndependentRegressionSparseModel train(Dataset<Regressor> examples)
SparseTrainer
public SkeletalIndependentRegressionSparseModel train(Dataset<Regressor> examples, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance)
SparseTrainer
train
in interface SparseTrainer<Regressor>
train
in interface Trainer<Regressor>
examples
- the data set containing the examples.runProvenance
- Training run specific provenance (e.g., fold number).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 SkeletalIndependentRegressionSparseModel 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.protected abstract boolean useBias()
protected abstract String getModelClassName()
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.