|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.lazy.LBR
Lazy Bayesian Rules implement a lazy learning approach to lessening the attribute-independence assumption of naive Bayes. For each object to be classified, LBR selects a set of attributes for which the attribute independence assumption should not be made. All remaining attributes are treated as independent of each other given the class and the selected set of attributes. LBR has demonstrated very high accuracy. Its training time is low but its classification time is high due to the use of a lazy methodology. This implementation does not include caching, that can substantially reduce classification time when multiple classifications are performed for a single training set. For more information, see
Zijian Zheng & G. Webb, (2000). Lazy Learning of Bayesian Rules. Machine Learning, 41(1): 53-84.
Nested Class Summary | |
class |
LBR.Indexes
Class for handling instances and the associated attributes. |
Constructor Summary | |
LBR()
|
Method Summary | |
double |
binomP(double r,
double n,
double p)
Significance test binomp: |
void |
buildClassifier(Instances instances)
For lazy learning, building classifier is only to prepare their inputs until classification time. |
double[] |
distributionForInstance(Instance testInstance)
Calculates the class membership probabilities for the given test instance. |
java.lang.String |
globalInfo()
|
int |
leaveOneOut(LBR.Indexes instanceIndex,
int[][][] counts,
int[] priors,
boolean[] errorFlags)
Leave-one-out strategy. |
double[] |
localDistributionForInstance(Instance instance,
LBR.Indexes instanceIndex)
Calculates the class membership probabilities. |
void |
localNaiveBayes(LBR.Indexes instanceIndex)
Class for building and using a simple Naive Bayes classifier. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.String |
toString()
Returns a description of the classifier. |
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LBR()
Method Detail |
public java.lang.String globalInfo()
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training data
java.lang.Exception
- if the preparation has not been generated.public double[] distributionForInstance(Instance testInstance) throws java.lang.Exception
distributionForInstance
in class Classifier
testInstance
- the instance to be classified
java.lang.Exception
- if distribution can't be computedpublic java.lang.String toString()
toString
in class java.lang.Object
public int leaveOneOut(LBR.Indexes instanceIndex, int[][][] counts, int[] priors, boolean[] errorFlags) throws java.lang.Exception
counts
- serving as all the counts of training data.priors
- serving as the number of instances in each class.
java.lang.Exception
public void localNaiveBayes(LBR.Indexes instanceIndex) throws java.lang.Exception
Richard Duda and Peter Hart (1973).Pattern Classification and Scene Analysis. Wiley, New York. This method only get m_Counts and m_Priors.
java.lang.Exception
- if m_Counts and m_Priors have not been
generated successfullypublic double[] localDistributionForInstance(Instance instance, LBR.Indexes instanceIndex) throws java.lang.Exception
instance
- the instance to be classified
java.lang.Exception
- if distribution can't be computedpublic double binomP(double r, double n, double p) throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] argv)
argv
- the options
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London