de.fu_berlin.ties.classify.feature
Class FeatureTransformer

java.lang.Object
  extended byde.fu_berlin.ties.classify.feature.FeatureTransformer
Direct Known Subclasses:
OSBTransformer, SBPHTransformer

public abstract class FeatureTransformer
extends Object

An feature transformer transforms a feature vector in a suitable way. Feature transformer can be used for feature selection (discarding irrelevant features), for combining features etc. Feature transforms can be chained -- in this case each feature transformer will work on the featured returned by the previous one.

Version:
$Revision: 1.1 $, $Date: 2004/04/13 07:59:54 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
static String CONFIG_TRANSFORMERS
          Configuration key specifying the list of transformers to chain.
 
Constructor Summary
FeatureTransformer(FeatureTransformer precTrans)
          Creates a new instance.
 
Method Summary
static FeatureTransformer createTransformer()
          Factory method that delegates to createTransformer() using the standard configuration.
static FeatureTransformer createTransformer(TiesConfiguration config)
          Factory method that creates a feature transformer based on the CONFIG_TRANSFORMERS key in the provided configuration.
protected abstract  FeatureVector doTransform(FeatureVector orgFeatures)
          Transforms a feature vector.
 FeatureTransformer getPrecedingTransformer()
          Returns the preceding transformer used if this transformer is part of a chain.
 String toString()
          Returns a string representation of this object.
 FeatureVector transform(FeatureVector orgFeatures)
          Transforms a feature vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIG_TRANSFORMERS

public static final String CONFIG_TRANSFORMERS
Configuration key specifying the list of transformers to chain.

See Also:
Constant Field Values
Constructor Detail

FeatureTransformer

public FeatureTransformer(FeatureTransformer precTrans)
Creates a new instance.

Parameters:
precTrans - the preceding transformer to use if this transformer is part of a chain; null otherwise
Method Detail

createTransformer

public static FeatureTransformer createTransformer()
                                            throws IllegalArgumentException
Factory method that delegates to createTransformer() using the standard configuration.

Returns:
the last transformer in the created transformer chain; or null is no transformers are specified
Throws:
IllegalArgumentException - if the value of the CONFIG_TRANSFORMERS key is invalid

createTransformer

public static FeatureTransformer createTransformer(TiesConfiguration config)
                                            throws IllegalArgumentException
Factory method that creates a feature transformer based on the CONFIG_TRANSFORMERS key in the provided configuration. This parameter must contain a list fully specified names of subclasses of this class) used in a chain.

Eeach specified transformer must provide a constructor accepting a preceding FeatureTransformer as first argument and a TiesConfiguration as second argument.

Parameters:
config - the configuration to use
Returns:
the last transformer in the created transformer chain; or null is no transformers are specified
Throws:
IllegalArgumentException - if the value of the CONFIG_TRANSFORMERS key is invalid

doTransform

protected abstract FeatureVector doTransform(FeatureVector orgFeatures)
Transforms a feature vector.

Parameters:
orgFeatures - the original feature vector to transform
Returns:
a new feature vector containing the transformed features

getPrecedingTransformer

public FeatureTransformer getPrecedingTransformer()
Returns the preceding transformer used if this transformer is part of a chain.

Returns:
the preceding transformer, if any; or null if this transformer is not part of a chain resp. is the first transformer in a chain

toString

public String toString()
Returns a string representation of this object.

Returns:
a textual representation

transform

public FeatureVector transform(FeatureVector orgFeatures)
Transforms a feature vector. This method calls itself on the preceding transformer (if any) prior to delegating to the abstract doTransform(FeatureVector) method.

Parameters:
orgFeatures - the original feature vector to transform
Returns:
a new feature vector containing the transformed features


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.