|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.DistributionClassifier
weka.classifiers.lazy.LBR
Class for building and using a Lazy Bayesian classifier.
The naive Bayesian classifier provides a simple and effective approach to
classifier learning, but its attribute independence assumption is often violated
in the real world. A number of approaches have sought to alleviate this problem.
A Bayesian tree learning algorithm builds a decision tree, and generates a local
naive Bayesian classifier at each leaf. The tests leading to a leaf can alleviate
attribute inter?dependencies for the local naive Bayesian classifier. However,
Bayesian tree learning still suffers from the small disjunct problem of tree learning.
While inferred Bayesian trees demonstrate low average prediction error rates, there is
reason to believe that error rates will be higher for those leaves with few training examples.
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. |
Field Summary | |
protected int |
bestCnt
|
protected int |
forCnt
|
protected java.util.ArrayList |
leftHand
|
protected int[][][] |
m_Counts
All the counts for nominal attributes. |
protected boolean[] |
m_ErrorFlags
|
protected int |
m_Errors
|
protected Instances |
m_Instances
The set of instances used for current training. |
protected boolean |
m_NCV
|
protected int |
m_numAtts
number of attributes for the dataset |
protected int |
m_Number
|
protected int |
m_NumberOfInstances
|
protected int |
m_numClasses
number of classes for dataset |
protected int |
m_numInsts
number of instances in dataset |
protected int[] |
m_Priors
The prior probabilities of the classes. |
protected int |
m_RemainderErrors
|
protected LBR.Indexes |
m_subInstances
|
protected boolean[] |
m_subOldErrorFlags
|
protected int[][][] |
m_tCounts
All the counts for nominal attributes. |
protected int[] |
m_tPriors
The prior probabilities of the classes. |
protected double[] |
posteriorsArray
|
protected static double |
SIGNLOWER
|
protected int |
tempCnt
|
protected LBR.Indexes |
tempSubInstances
|
protected int |
whileCnt
|
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.DistributionClassifier |
calculateEntropy, calculateLabeledInstanceMargin, calculateMargin, classifyInstance |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int[][][] m_Counts
protected int[][][] m_tCounts
protected int[] m_Priors
protected int[] m_tPriors
protected int m_numAtts
protected int m_numClasses
protected int m_numInsts
protected Instances m_Instances
protected int m_Errors
protected boolean[] m_ErrorFlags
protected java.util.ArrayList leftHand
protected static final double SIGNLOWER
protected boolean[] m_subOldErrorFlags
protected int m_RemainderErrors
protected int m_Number
protected int m_NumberOfInstances
protected boolean m_NCV
protected LBR.Indexes m_subInstances
protected LBR.Indexes tempSubInstances
protected double[] posteriorsArray
protected int bestCnt
protected int tempCnt
protected int forCnt
protected int whileCnt
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 DistributionClassifier
testInstance
- the instance to be classified
java.lang.Exception
- if distribution can't be computedpublic java.lang.String toString()
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 |