Class SLMTrainer
java.lang.Object
org.tribuo.regression.slm.SLMTrainer
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
,SparseTrainer<Regressor>
,Trainer<Regressor>
,WeightedExamples
- Direct Known Subclasses:
LARSLassoTrainer
,LARSTrainer
A trainer for a sparse linear regression model.
Uses sequential forward selection to construct the model. Optionally can
normalize the data first. Each output dimension is trained independently
with no shared regularization.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected boolean
protected int
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
For OLCUT.SLMTrainer
(boolean normalize) Constructs a trainer for a sparse linear model using sequential forward selection.SLMTrainer
(boolean normalize, int maxNumFeatures) Constructs a trainer for a sparse linear model using sequential forward selection. -
Method Summary
Modifier and TypeMethodDescriptionint
The number of times this trainer instance has had it's train method invoked.protected org.apache.commons.math3.linear.RealVector
newWeights
(org.tribuo.regression.slm.SLMTrainer.SLMState state) toString()
train
(Dataset<Regressor> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) Trains a sparse linear model.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
Methods inherited from interface org.tribuo.SparseTrainer
train
-
Field Details
-
maxNumFeatures
-
normalize
-
trainInvocationCounter
-
-
Constructor Details
-
SLMTrainer
Constructs a trainer for a sparse linear model using sequential forward selection.- Parameters:
normalize
- Normalizes the data first (i.e., removes the bias term).maxNumFeatures
- The maximum number of features to select. Supply -1 to select all features.
-
SLMTrainer
Constructs a trainer for a sparse linear model using sequential forward selection.Selects all the features.
- Parameters:
normalize
- Normalizes the data first (i.e., removes the bias term).
-
SLMTrainer
protected SLMTrainer()For OLCUT.
-
-
Method Details
-
newWeights
protected org.apache.commons.math3.linear.RealVector newWeights(org.tribuo.regression.slm.SLMTrainer.SLMState state) -
train
-
getInvocationCount
Description copied from interface:Trainer
The number of times this trainer instance has had it's train method invoked.This is used to determine how many times the trainer's RNG has been accessed to ensure replicability in the random number stream.
- Specified by:
getInvocationCount
in interfaceTrainer<Regressor>
- Returns:
- The number of train invocations.
-
getProvenance
- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
-
toString
-