Package org.tribuo.data.columnar
Class ColumnarFeature
java.lang.Object
org.tribuo.Feature
org.tribuo.data.columnar.ColumnarFeature
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Feature>
A Feature with extra bookkeeping for use inside the columnar package.
Example
s 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 Summary
-
Constructor Summary
ConstructorDescriptionColumnarFeature
(String fieldName, double value) Constructs aColumnarFeature
from the field name.ColumnarFeature
(String fieldName, String columnEntry, double value) Constructs aColumnarFeature
from the field name, column entry and value.ColumnarFeature
(String firstFieldName, String secondFieldName, String columnEntry, double value) Constructs aColumnarFeature
which is the conjunction of features from two fields. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generateFeatureName
(String fieldName, String name) Generates a feature name based on the field name and the name.static String
generateFeatureName
(String firstFieldName, String secondFieldName, String name) Generates a feature name used for conjunction features.Gets the columnEntry (i.e., the feature name produced by theFieldExtractor
without the fieldName).Gets the field name.If it's a conjunction feature, return the first field name.If it's a conjunction feature, return the second field name.
-
Field Details
-
CONJUNCTION
The string used as the field name of conjunction features.- See Also:
-
JOINER
The joiner between the field name and feature name.- See Also:
-
-
Constructor Details
-
ColumnarFeature
Constructs aColumnarFeature
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
Constructs aColumnarFeature
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 aColumnarFeature
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
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 andCONJUNCTION
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
Gets the field name. ReturnsCONJUNCTION
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 theFieldExtractor
without the fieldName).- Returns:
- The feature's column entry.
-