Class SkeletalIndependentRegressionModel

java.lang.Object
org.tribuo.Model<Regressor>
org.tribuo.regression.impl.SkeletalIndependentRegressionModel
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>, Serializable, ProtoSerializable<org.tribuo.protos.core.ModelProto>

public abstract class SkeletalIndependentRegressionModel extends Model<Regressor>
A Model 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

    • SkeletalIndependentRegressionModel

      protected SkeletalIndependentRegressionModel(String name, String[] dimensions, ModelProvenance modelProvenance, ImmutableFeatureMap featureMap, ImmutableOutputInfo<Regressor> outputInfo)
      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.
  • 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.

      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.