net.sf.classifier4J
Interface IClassifier

All Known Subinterfaces:
ICategorisedClassifier, ITrainableClassifier
All Known Implementing Classes:
AbstractCategorizedTrainableClassifier, AbstractClassifier, SimpleClassifier

public interface IClassifier

Defines an interface for the classification of Strings.

Use the isMatch method if you want true/false matching, or use the classify method if you match probability.

The isMatch method will return a boolean representing if a string matches whatever criteria the implmentation is matching on. In the default implemnetation this is done by calling classify and checking if the returned match probability is greater than or equal to DEFAULT_CUTOFF.

The classify method will return a double value representing the likelyhood that the string passed to it is a match on whatever criteria the implmentation is matching on.

When implementing this class, it is recommended that the classify method should not return the values 1 or 0 except in the cases there the classifier can guarentee that the string is a match doe does not match. For non-absolute matching algorithms LOWER_BOUND and UPPER_BOUND should be used.

Author:
Nick Lothian, Peter Leschev
See Also:
AbstractClassifier

Field Summary
static double DEFAULT_CUTOFF
          Default cutoff value used by defautl implmentation of isMatch.
static double LOWER_BOUND
          The minimum likelyhood that a string matches
static double NEUTRAL_PROBABILITY
          Default value to use if the implementation cannot work out how well a string matches.
static double UPPER_BOUND
          The maximum likelyhood that a string matches
 
Method Summary
 double classify(java.lang.String input)
          Function to determine the probability string matches a criteria.
 boolean isMatch(double matchProbability)
          Convenience method which takes a match probability (calculated by classify(java.lang.String)) and checks if it would be classified as a match or not
 boolean isMatch(java.lang.String input)
          Function to determine if a string matches a criteria.
 void setMatchCutoff(double cutoff)
          Sets the cutoff below which the input is not considered a match
 

Field Detail

NEUTRAL_PROBABILITY

public static final double NEUTRAL_PROBABILITY
Default value to use if the implementation cannot work out how well a string matches.

See Also:
Constant Field Values

LOWER_BOUND

public static final double LOWER_BOUND
The minimum likelyhood that a string matches

See Also:
Constant Field Values

UPPER_BOUND

public static final double UPPER_BOUND
The maximum likelyhood that a string matches

See Also:
Constant Field Values

DEFAULT_CUTOFF

public static final double DEFAULT_CUTOFF
Default cutoff value used by defautl implmentation of isMatch. Any match probability greater than or equal to this value will be classified as a match. The value is 0.9d

See Also:
Constant Field Values
Method Detail

setMatchCutoff

public void setMatchCutoff(double cutoff)
Sets the cutoff below which the input is not considered a match

Parameters:
cutoff - the level below which isMatch will return false. Should be between 0 and 1.

classify

public double classify(java.lang.String input)
                throws ClassifierException
Function to determine the probability string matches a criteria.

Parameters:
input - the string to classify
Returns:
the likelyhood that this string is a match for this net.sf.classifier4J. 1 means 100% likely.
Throws:
ClassifierException - If a non-recoverable problem occurs

isMatch

public boolean isMatch(java.lang.String input)
                throws ClassifierException
Function to determine if a string matches a criteria.

Parameters:
input - the string to classify
Returns:
true if the input string has a probability >= the cutoff probability of matching
Throws:
ClassifierException - If a non-recoverable problem occurs

isMatch

public boolean isMatch(double matchProbability)
Convenience method which takes a match probability (calculated by classify(java.lang.String)) and checks if it would be classified as a match or not

Parameters:
matchProbability -
Returns:
true if match, false otherwise


Copyright © 2003-2005 Nick Lothian. All Rights Reserved.