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

public abstract class SkeletalIndependentRegressionSparseModel extends SparseModel<Regressor>
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 Details

    • dimensions

      protected final String[] 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

      public Prediction<Regressor> predict(Example<Regressor> example)
      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.

      Specified by:
      predict in class Model<Regressor>
      Parameters:
      example - the example to predict.
      Returns:
      the result of the prediction.
    • createFeatures

      protected SparseVector createFeatures(Example<Regressor> example)
      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

      protected abstract Regressor.DimensionTuple scoreDimension(int dimensionIdx, SparseVector features)
      Makes a prediction for a single dimension.
      Parameters:
      dimensionIdx - The dimension index to predict.
      features - The features to use.
      Returns:
      A single dimension prediction.