Class AbstractSGDModel<T extends Output<T>>
java.lang.Object
org.tribuo.Model<T>
org.tribuo.common.sgd.AbstractSGDModel<T>
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>,Serializable
- Direct Known Subclasses:
AbstractLinearSGDModel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classA nominal tuple used to capture the prediction and the number of active features used by the model. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected FeedForwardParametersThe weights for this model.Fields inherited from class org.tribuo.Model
ALL_OUTPUTS, BIAS_FEATURE, featureIDMap, generatesProbabilities, name, outputIDInfo, provenance, provenanceOutput -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSGDModel(String name, ModelProvenance provenance, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<T> outputIDInfo, FeedForwardParameters weights, boolean generatesProbabilities, boolean addBias) Constructs a linear model trained via SGD. -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of the model parameters.protected AbstractSGDModel.PredAndActivepredictSingle(Example<T> example) Generates the dense vector prediction from the supplied example.Methods inherited from class org.tribuo.Model
copy, copy, generatesProbabilities, getExcuse, getExcuses, getFeatureIDMap, getName, getOutputIDInfo, getProvenance, getTopFeatures, innerPredict, predict, predict, predict, setName, toString, validate
-
Field Details
-
modelParameters
The weights for this model. -
addBias
protected boolean addBias
-
-
Constructor Details
-
AbstractSGDModel
protected AbstractSGDModel(String name, ModelProvenance provenance, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<T> outputIDInfo, FeedForwardParameters weights, boolean generatesProbabilities, boolean addBias) Constructs a linear model trained via SGD.- Parameters:
name- The model name.provenance- The model provenance.featureIDMap- The feature domain.outputIDInfo- The output domain.weights- The model weights.generatesProbabilities- Does this model generate probabilities?addBias- Should the model add a bias feature to the feature vector?
-
-
Method Details
-
predictSingle
Generates the dense vector prediction from the supplied example.- Parameters:
example- The example to use for prediction.- Returns:
- The prediction and the number of features involved.
-
getModelParameters
Returns a copy of the model parameters.- Returns:
- A copy of the model parameters.
-