Class ColumnarFeature

java.lang.Object
org.tribuo.Feature
org.tribuo.data.columnar.ColumnarFeature
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Feature>

public class ColumnarFeature extends Feature
A Feature with extra bookkeeping for use inside the columnar package.

Examples may destroy and recreate Feature instances so don't expect ColumnarFeatures to still be ColumnarFeatures if you probe the Example after construction.

See Also:
  • Field Details

    • CONJUNCTION

      public static final String CONJUNCTION
      The string used as the field name of conjunction features.
      See Also:
    • JOINER

      public static final String JOINER
      The joiner between the field name and feature name.
      See Also:
  • Constructor Details

    • ColumnarFeature

      public ColumnarFeature(String fieldName, double value)
      Constructs a ColumnarFeature from the field name. The column entry is blank.

      This produces a ColumnarFeature which is identical to a Feature.

      Parameters:
      fieldName - The field name.
      value - The feature value.
    • ColumnarFeature

      public ColumnarFeature(String fieldName, String columnEntry, double value)
      Constructs a ColumnarFeature from the field name, column entry and value.
      Parameters:
      fieldName - The field name.
      columnEntry - The name of the extracted value from the field.
      value - The feature value.
    • ColumnarFeature

      public ColumnarFeature(String firstFieldName, String secondFieldName, String columnEntry, double value)
      Constructs a ColumnarFeature which is the conjunction of features from two fields.
      Parameters:
      firstFieldName - The first field name.
      secondFieldName - The second field name.
      columnEntry - The name of the extracted value from the field.
      value - The feature value.
  • Method Details

    • generateFeatureName

      public static String generateFeatureName(String fieldName, String name)
      Generates a feature name based on the field name and the name.

      Uses JOINER to join the strings.

      Parameters:
      fieldName - The field name.
      name - The name of the extracted feature.
      Returns:
      The new feature name.
    • generateFeatureName

      public static String generateFeatureName(String firstFieldName, String secondFieldName, String name)
      Generates a feature name used for conjunction features.

      Uses JOINER to join the strings and CONJUNCTION to prepend the name.

      Parameters:
      firstFieldName - The name of the first field.
      secondFieldName - The name of the second field.
      name - The name of the extracted feature.
      Returns:
      The new feature name.
    • getFieldName

      public String getFieldName()
      Gets the field name. Returns CONJUNCTION if it's a conjunction.
      Returns:
      The field name.
    • getFirstFieldName

      public String getFirstFieldName()
      If it's a conjunction feature, return the first field name. Otherwise return an empty String.
      Returns:
      The first field name, or an empty string.
    • getSecondFieldName

      public String getSecondFieldName()
      If it's a conjunction feature, return the second field name. Otherwise return an empty String.
      Returns:
      The second field name, or an empty string.
    • getColumnEntry

      public String getColumnEntry()
      Gets the columnEntry (i.e., the feature name produced by the FieldExtractor without the fieldName).
      Returns:
      The feature's column entry.