Package org.tribuo

Class SparseModel<T extends Output<T>>

java.lang.Object
org.tribuo.Model<T>
org.tribuo.SparseModel<T>
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.Provenancable<ModelProvenance>, Serializable
Direct Known Subclasses:
SkeletalIndependentRegressionSparseModel, TreeModel

public abstract class SparseModel<T extends Output<T>> extends Model<T>
A model which uses a subset of the features it knows about to make predictions.
See Also:
  • Constructor Details

    • SparseModel

      public SparseModel(String name, ModelProvenance provenance, ImmutableFeatureMap featureIDMap, ImmutableOutputInfo<T> outputIDInfo, boolean generatesProbabilities, Map<String,List<String>> activeFeatures)
      Constructs a sparse model from the supplied arguments.
      Parameters:
      name - The model name.
      provenance - The model provenance.
      featureIDMap - The features the model knows.
      outputIDInfo - The outputs the model can produce.
      generatesProbabilities - Does this model generate probabilistic outputs.
      activeFeatures - The active features in this model.
  • Method Details

    • getActiveFeatures

      public Map<String,List<String>> getActiveFeatures()
      Return an immutable view on the active features for each dimension.

      Sorted lexicographically.

      Returns:
      The active features.
    • copy

      public SparseModel<T> copy()
      Description copied from class: Model
      Copies a model, returning a deep copy of any mutable state, and a shallow copy otherwise.
      Overrides:
      copy in class Model<T extends Output<T>>
      Returns:
      A copy of the model.