Package org.tribuo

Class MutableFeatureMap

java.lang.Object
org.tribuo.FeatureMap
org.tribuo.MutableFeatureMap
All Implemented Interfaces:
Serializable, Iterable<VariableInfo>

public class MutableFeatureMap extends FeatureMap
A feature map that can record new feature value observations.
See Also:
  • Constructor Details

    • MutableFeatureMap

      public MutableFeatureMap()
      Creates an empty feature map which converts high cardinality categorical variable infos into reals.

      The conversion threshold is CategoricalInfo.THRESHOLD.

    • MutableFeatureMap

      public MutableFeatureMap(boolean convertHighCardinality)
      Creates an empty feature map which can optionally convert high cardinality categorical variable infos into reals.

      The conversion threshold is CategoricalInfo.THRESHOLD.

      Parameters:
      convertHighCardinality - Should this feature map convert high cardinality categorical variables into real variables?
  • Method Details

    • put

      public VariableInfo put(VariableInfo info)
      Adds a variable info into the feature map.

      Returns the old one if there was a name collision, otherwise returns null.

      Parameters:
      info - The info to add.
      Returns:
      The old variable info or null.
    • add

      public void add(String name, double value)
      Adds an occurrence of a feature with a given name.
      Parameters:
      name - the name of the feature.
      value - the observed value of that feature.
    • clear

      public void clear()
      Clears all the feature observations.