Package org.tribuo.regression.impl
Class SkeletalIndependentRegressionSparseModel
java.lang.Object
org.tribuo.Model<T>
org.tribuo.SparseModel<Regressor>
org.tribuo.regression.impl.SkeletalIndependentRegressionSparseModel
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>
,Serializable
,ProtoSerializable<org.tribuo.protos.core.ModelProto>
- Direct Known Subclasses:
SparseLinearModel
A
SparseModel
which wraps n independent regression models, where n is the
size of the MultipleRegressor domain. Each model independently predicts
a single regression dimension.- See Also:
-
Field Summary
Fields inherited from class org.tribuo.Model
ALL_OUTPUTS, BIAS_FEATURE, featureIDMap, generatesProbabilities, name, outputIDInfo, provenance, provenanceOutput
Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Constructor Summary
ModifierConstructorDescriptionprotected
SkeletalIndependentRegressionSparseModel
(String name, String[] dimensions, ModelProvenance modelProvenance, ImmutableFeatureMap featureMap, ImmutableOutputInfo<Regressor> outputInfo, Map<String, List<String>> activeFeatures) models.size() must equal labelInfo.getDomain().size() -
Method Summary
Modifier and TypeMethodDescriptionprotected SparseVector
createFeatures
(Example<Regressor> example) Creates the feature vector.Uses the model to predict the output for a single example.protected abstract Regressor.DimensionTuple
scoreDimension
(int dimensionIdx, SparseVector features) Makes a prediction for a single dimension.Methods inherited from class org.tribuo.SparseModel
copy, getActiveFeatures
Methods inherited from class org.tribuo.Model
castModel, copy, createDataCarrier, deserialize, deserializeFromFile, deserializeFromStream, generatesProbabilities, getExcuse, getExcuses, getFeatureIDMap, getName, getOutputIDInfo, getProvenance, getTopFeatures, innerPredict, predict, predict, serialize, serializeToFile, serializeToStream, setName, toString, validate
-
Field Details
-
dimensions
The output dimension names.
-
-
Constructor Details
-
SkeletalIndependentRegressionSparseModel
protected SkeletalIndependentRegressionSparseModel(String name, String[] dimensions, ModelProvenance modelProvenance, ImmutableFeatureMap featureMap, ImmutableOutputInfo<Regressor> outputInfo, Map<String, List<String>> activeFeatures) models.size() must equal labelInfo.getDomain().size()- Parameters:
name
- Model name.dimensions
- Dimension names.modelProvenance
- The model provenance.featureMap
- The feature domain used in training.outputInfo
- The output domain used in training.activeFeatures
- The active features in this model.
-
-
Method Details
-
predict
Description copied from class:Model
Uses the model to predict the output for a single example.predict does not mutate the example.
Throws
IllegalArgumentException
if the example has no features or no feature overlap with the model. -
createFeatures
Creates the feature vector. Does not include a bias term.Designed to be overridden, called by the predict method.
- Parameters:
example
- The example to convert.- Returns:
- The feature vector.
-
scoreDimension
Makes a prediction for a single dimension.- Parameters:
dimensionIdx
- The dimension index to predict.features
- The features to use.- Returns:
- A single dimension prediction.
-