public class InteractionFeatureExtractor<E> extends Object implements FeatureExtractor<E>, Serializable
InteractionFeatureExtractor produces interaction
features between two feature extractors. The value of an
interaction feature is the product of the values of the individual
features. The feature itself will be prefixed with a specific
string and the features for the interaction are separated by a
specific string.
If the two feature extractors are the same, then only one feature extraction is performed on an input and redundant features are removed.
{"a"->1.5, "b"->2.0, "c"->3.0}
and {"d"->1.0, "e"-> 0.25}, with prefix I:
and separator *, then the interaction features are
{"I:a*d"->1.5, "I:a*e"->0.375, "I:b*d"->2.0, "I:b*e"->0.5, "I:c*d"->3.0, "I:c*e"->0.75}.
{"x"->-1.5, "y"->2.0, "z"->1.0},
the interaction feature map is
{"I:x*x"->2.25, "I:x*y"->-3.0, "I:x*z"->-1.5, "I:y*y"->4.0, "I:y*z"->2.0, "I:z*z"->1.0}.
In order to preserve uniqueness of the feature output in the
one-extractor case, we need to sort the features. So we make sure
that the features are in sorted order in the combination (as
determined by the natural sort order defined for String by
its compareTo(String) method. Specifically, we get
"I:x*z", but not "I:z*x" in the case above.
This is not an issue for the two-extractor case, as you get all
pairs, with the first extractor's feature always coming first
in the resulting feature.
| Constructor and Description |
|---|
InteractionFeatureExtractor(String prefix,
String separator,
FeatureExtractor<E> extractor)
Construct a feature extractor for interactions between the
features extracted by the specified extractor, creating new
features with the specified prefix and separator.
|
InteractionFeatureExtractor(String prefix,
String separator,
FeatureExtractor<E> extractor1,
FeatureExtractor<E> extractor2)
Construct a feature extractor for interactions between
the features extracted by the specified extractors, creating
new features with the specified prefix and separator.
|
public InteractionFeatureExtractor(String prefix, String separator, FeatureExtractor<E> extractor1, FeatureExtractor<E> extractor2)
prefix - Prefix to prepend to interaction features.separator - Separator between features in interaction features.extractor1 - First feature extractor.extractor2 - Second feature extractor.public InteractionFeatureExtractor(String prefix, String separator, FeatureExtractor<E> extractor)
prefix - Prefix to prepend to interaction features.separator - Separator between features in interaction features.extractor - Feature extractor.Copyright © 2016 Alias-i, Inc.. All rights reserved.