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 intprotected booleanprotected intFields inherited from interface org.tribuo.Trainer
DEFAULT_SEED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFor 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 TypeMethodDescriptionintThe number of times this trainer instance has had it's train method invoked.protected org.apache.commons.math3.linear.RealVectornewWeights(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, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfigMethods inherited from interface org.tribuo.SparseTrainer
train
-
Field Details
-
maxNumFeatures
@Config(description="Maximum number of features to use.") protected int maxNumFeatures -
normalize
@Config(description="Normalize the data first.") protected boolean normalize -
trainInvocationCounter
protected int trainInvocationCounter
-
-
Constructor Details
-
SLMTrainer
public SLMTrainer(boolean normalize, int maxNumFeatures) 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
public SLMTrainer(boolean normalize) 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
public SparseLinearModel train(Dataset<Regressor> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) Trains a sparse linear model. -
getInvocationCount
public int getInvocationCount()Description copied from interface:TrainerThe 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:
getInvocationCountin interfaceTrainer<Regressor>- Returns:
- The number of train invocations.
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
-
toString
-