Package org.tribuo

Class SparseModel<T extends Output<T>>

All Implemented Interfaces:<ModelProvenance>, Serializable, ProtoSerializable<org.tribuo.protos.core.ModelProto>
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.
      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.

      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.
      copy in class Model<T extends Output<T>>
      A copy of the model.