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

  • Constructor Details

    • 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.

      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

      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

      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

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