Package org.tribuo

Class Feature

java.lang.Object
org.tribuo.Feature
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Feature>
Direct Known Subclasses:
ColumnarFeature

public class Feature extends Object implements Serializable, Cloneable, Comparable<Feature>
A class for features. Features are an immutable tuple of name and a double value.

Features can be manufactured by the Example and are not expected to be long lived objects. They may be deconstructed when stored in an Example. One day they should become value/inline types.

See Also:
  • Field Details

    • name

      protected final String name
      The feature name.
    • value

      protected final double value
      The feature value.
  • Constructor Details

    • Feature

      public Feature(String name, double value)
      Creates an immutable feature.
      Parameters:
      name - The feature name.
      value - The feature value.
  • Method Details

    • getName

      public String getName()
      Returns the feature name.
      Returns:
      The feature name
    • getValue

      public double getValue()
      Returns the feature value.
      Returns:
      The feature value.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toHTML

      public String toHTML()
      Returns the feature name formatted as a table cell.
      Returns:
      The feature name.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Feature clone()
      Overrides:
      clone in class Object
    • featureNameComparator

      public static Comparator<Feature> featureNameComparator()
      A comparator using the lexicographic ordering of feature names.
      Returns:
      A lexicographic comparator.
    • compareTo

      public int compareTo(Feature o)
      Specified by:
      compareTo in interface Comparable<Feature>