|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.classify.feature.FeatureTransformer
de.fu_berlin.ties.classify.feature.SBPHTransformer
public class SBPHTransformer
Transforms a feature vector using a simple implementation of the sparse binary polynomial hashing (SBPH) technique introduced by CRM114. This transformer discard all comment-only features (indeed all comments). It slides of window of length N over the remaining original features. For each window position, it counts in binary from 1 to 2N. For each odd number, a joint feature is generated where original features at "1" positions are visible and original features at "0" positions are hidden. Separators prior to the first feature are discarded, but all inner separators are kept. E.g. if N=3 and a pipe character "|" is used as separator, from the original features "a", "b", "c", four joint features will be generated at the last position: "c" (binary 1=001), "b|c" (binary 3=011), "a||c" (binary 5=101), "a|b|c" (binary 7=111). Thus 2N-1 joint features are generated for each original (non-comment) feature (except for the very first features).
Instances of this class are thread-safe.
Field Summary | |
---|---|
static String |
DEFAULT_SEPARATOR
The separator used by default (a space character). |
Fields inherited from class de.fu_berlin.ties.classify.feature.FeatureTransformer |
---|
CONFIG_TRANSFORMERS |
Constructor Summary | |
---|---|
SBPHTransformer(FeatureTransformer precTrans,
int len,
String sep)
Creates a new instance. |
|
SBPHTransformer(FeatureTransformer precTrans,
TiesConfiguration config)
Creates a new instance. |
Method Summary | |
---|---|
protected FeatureVector |
doTransform(FeatureVector orgFeatures)
Transforms a feature vector. |
int |
getLength()
Returns the maximum number of original features joined. |
String |
getSeparator()
Returns the string used to separate original features (by default a space character). |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.classify.feature.FeatureTransformer |
---|
createTransformer, createTransformer, getPrecedingTransformer, transform |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_SEPARATOR
Constructor Detail |
---|
public SBPHTransformer(FeatureTransformer precTrans, int len, String sep)
precTrans
- the preceding transformer to use if this transformer
is part of a chain; null
otherwiselen
- the maximum number of original features joinedsep
- the string used to separate original features -- this string
should never occur within original featurespublic SBPHTransformer(FeatureTransformer precTrans, TiesConfiguration config)
precTrans
- the preceding transformer to use if this transformer
is part of a chain; null
otherwiseconfig
- used to configure this instanceMethod Detail |
---|
protected FeatureVector doTransform(FeatureVector orgFeatures)
doTransform
in class FeatureTransformer
orgFeatures
- the original feature vector to transform
public int getLength()
public String getSeparator()
public String toString()
toString
in class FeatureTransformer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |