de.fhdarmstadt.fbi.dtree.evaluator
Class Evaluator

java.lang.Object
  extended byde.fhdarmstadt.fbi.dtree.evaluator.Evaluator

public class Evaluator
extends java.lang.Object

The Evaluator is used to evaulate nodes from a decision tree. Every evaluator instance is bound to a specific alphabet.


Constructor Summary
Evaluator(Alphabet alphabet)
          Creates a new Evaluator instance for the given alphabet.
 
Method Summary
 EvaluationResult evaluate(DTreeNode node, DataSource dataSource)
          Evaulates all data stored in the datasource agains the given decision tree node.
 EvaluationResult evaluateAll(DTreeNode node, DataSource dataSource)
          Evaluates the given node and all child nodes against the data from the datasource.
static EvaluationResult evaluateTree(DTree tree, DataSource ds)
          Creates a new Evaluator and evaluates the given tree starting at the root node of the tree.
 Alphabet getAlphabet()
          Returns the (immutable) alphabet used in this evaluator.
 boolean isMatch(DTreeNode treeNode, TestData sequence)
          Tests, whether the pattern of the given tree node matches the given test data.
 boolean isMatch(RegularPattern nodePattern, TestData sequence)
          Tests, whether the given pattern matches the given test data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Evaluator

public Evaluator(Alphabet alphabet)
Creates a new Evaluator instance for the given alphabet.

Parameters:
alphabet - the alphabet
Throws:
java.lang.IllegalArgumentException - if the given alphabet is empty
java.lang.NullPointerException - if the given alphabet is null.
Method Detail

getAlphabet

public Alphabet getAlphabet()
Returns the (immutable) alphabet used in this evaluator.

Returns:
the alphabet

isMatch

public boolean isMatch(DTreeNode treeNode,
                       TestData sequence)
Tests, whether the pattern of the given tree node matches the given test data. The test data's classification is not used.

Parameters:
treeNode - the tree node, which should be tested.
sequence - the test data.
Returns:
true, if the pattern of the node matches the given test data or false otherwise.
Throws:
java.lang.NullPointerException - if the given node or the test data is null
java.lang.IllegalArgumentException - if the test data does not match the alphabet.

isMatch

public boolean isMatch(RegularPattern nodePattern,
                       TestData sequence)
Tests, whether the given pattern matches the given test data. The patterns classification is used to decide, whether the result of the evaluation must be negated.

The test data's classification is not used.

Parameters:
nodePattern - pattern, which should be tested.
sequence - the test data.
Returns:
true, if the pattern of the node matches the given test data or false otherwise.
Throws:
java.lang.NullPointerException - if the pattern or the test data is null
java.lang.IllegalArgumentException - if the test data does not match the alphabet.

evaluate

public EvaluationResult evaluate(DTreeNode node,
                                 DataSource dataSource)
Evaulates all data stored in the datasource agains the given decision tree node. The resulting data

Parameters:
node - the node, which should be evaluated.
dataSource - the datasource from where to read the test data.
Returns:
an EvaluationResult.
Throws:
java.lang.NullPointerException - if either the node, the datasource or an element in the datasource is null.
java.lang.IllegalArgumentException - if the test data does not match the alphabet.

evaluateAll

public EvaluationResult evaluateAll(DTreeNode node,
                                    DataSource dataSource)
Evaluates the given node and all child nodes against the data from the datasource.

Parameters:
node - the node that should be evaluated
dataSource - the datasource containing the data.
Returns:
the generated cummulative evaluation result.
Throws:
java.lang.NullPointerException - if either the node, the datasource or an element in the datasource is null.
java.lang.IllegalArgumentException - if the test data does not match the alphabet.

evaluateTree

public static EvaluationResult evaluateTree(DTree tree,
                                            DataSource ds)
Creates a new Evaluator and evaluates the given tree starting at the root node of the tree.

Parameters:
tree - the tree that should be evaluated
ds - the data source for the tree
Returns:
the cummulated evaluation result .
Throws:
java.lang.NullPointerException - if either the tree, the datasource or an element in the datasource is null.
java.lang.IllegalArgumentException - if the test data does not match the alphabet of the tree.