public class LBR extends Classifier implements TechnicalInformationHandler
@article{Zheng2000, author = {Zijian Zheng and G. Webb}, journal = {Machine Learning}, number = {1}, pages = {53-84}, title = {Lazy Learning of Bayesian Rules}, volume = {4}, year = {2000} }Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
Modifier and Type | Class and Description |
---|---|
class |
LBR.Indexes
Class for handling instances and the associated attributes.
|
Modifier and Type | Field and Description |
---|---|
protected int |
bestCnt |
protected int |
forCnt |
protected ArrayList |
leftHand
best attribute's index list.
|
protected int[][][] |
m_Counts
All the counts for nominal attributes.
|
protected boolean[] |
m_ErrorFlags
leave-one-out error flags on the training dataaet.
|
protected int |
m_Errors
leave-one-out errors on the training dataset.
|
protected Instances |
m_Instances
The set of instances used for current training.
|
protected boolean |
m_NCV
for printing in n-fold cross validation
|
protected int |
m_numAtts
number of attributes for the dataset
|
protected int |
m_Number
the number of instance to be processed
|
protected int |
m_NumberOfInstances
the Number of Instances to be used in building a classifiers
|
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
the number of instances to be classified incorrectly
besides the subset.
|
protected LBR.Indexes |
m_subInstances
index of instances and attributes for the given dataset
|
protected boolean[] |
m_subOldErrorFlags
following is defined by wangzh,
the number of instances to be classified incorrectly
on the subset.
|
protected int[][][] |
m_tCounts
All the counts for nominal attributes.
|
protected int[] |
m_tPriors
The prior probabilities of the classes.
|
protected double[] |
posteriorsArray
probability values array
|
protected static double |
SIGNLOWER
significantly lower
|
protected int |
tempCnt |
protected LBR.Indexes |
tempSubInstances
index of instances and attributes for the given dataset
|
protected int |
whileCnt |
m_Debug
Constructor and Description |
---|
LBR() |
Modifier and Type | Method and Description |
---|---|
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.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
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(String[] argv)
Main method for testing this class.
|
String |
toString()
Returns a description of the classifier.
|
classifyInstance, debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, makeCopy, runClassifier, setDebug, setOptions
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 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
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances instances) throws Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training dataException
- if the preparation has not been generated.public double[] distributionForInstance(Instance testInstance) throws Exception
distributionForInstance
in class Classifier
testInstance
- the instance to be classifiedException
- if distribution can't be computedpublic String toString()
public int leaveOneOut(LBR.Indexes instanceIndex, int[][][] counts, int[] priors, boolean[] errorFlags) throws Exception
instanceIndex
- set of instances serving as training data.counts
- serving as all the counts of training data.priors
- serving as the number of instances in each class.errorFlags
- for the errorsException
- if something goes wrongpublic void localNaiveBayes(LBR.Indexes instanceIndex) throws Exception
Richard Duda and Peter Hart (1973).Pattern Classification and Scene Analysis. Wiley, New York. This method only get m_Counts and m_Priors.
instanceIndex
- set of instances serving as training dataException
- if m_Counts and m_Priors have not been
generated successfullypublic double[] localDistributionForInstance(Instance instance, LBR.Indexes instanceIndex) throws Exception
instance
- the instance to be classifiedinstanceIndex
- Exception
- if distribution can't be computedpublic double binomP(double r, double n, double p) throws Exception
r
- n
- p
- Exception
- if computation failspublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(String[] argv)
argv
- the optionsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.