calhoun.analysis.crf
Interface FeatureList


public interface FeatureList

used to pass feature evaluations from a FeatureManager to the Conrad engine during an evaluate call. A FeatureList is always the last argument passed to an evaluate call on FeatureManager. It allows the feature to add in evaluations or declare the given node or edge invalid. This interface is present so that new memory does not have to be allocated during the evaluation process and so that a given FeatureManager can return any arbitrary number of feature evaluations from an evaluate call.


Method Summary
 void addFeature(int index, double value)
          returns a feature value for this evaluation.
 void invalidate()
          specifies that node, edge, or segment specified in the evaluate call is invalid.
 boolean isValid()
          checks if the current node, edge, or segment is valid.
 

Method Detail

addFeature

void addFeature(int index,
                double value)
returns a feature value for this evaluation. Since a FeatureManager can provide evaluations for more than one feature, it is necessary to identify the specific feature by passing its index.

If an evaluate call is made and addFeature is not called for a given feature index, then the value for that feature is assumed to be zero. This makes it very efficient to evaluate sparse features.

The value can be any real number, and passing zero is allowed but unnecessary.

Parameters:
index - the index of the feature which has been evaluated
value - the value of the feature.

invalidate

void invalidate()
specifies that node, edge, or segment specified in the evaluate call is invalid. When invalid nodes or edges are found the engine will exclude all hidden state paths including that node, edge, or segment from both training and inference. This is very different from returning zero for a given feature. Note that if even one FeatureManager invalidates a node or edge, then no feature evaluations at that position will be used. This is very different from returning zero, which simply means that the path is valid, but the feature doesn't provide any information.


isValid

boolean isValid()
checks if the current node, edge, or segment is valid. This can be used to speed up processing in more complicated FeatureManagers, since once invalidate has been called during an evaluate function there is no point in adding any new feature values.

Returns:
true if the FeatureList is still valid.