|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.bayes.BayesNet
Base class for a Bayes Network classifier. Provides datastructures (network structure, conditional probability distributions, etc.) and facilities common to Bayes Network learning algorithms like K2 and B. Works with nominal variables and no missing values only.
Field Summary | |
Instances |
m_Instances
The dataset header for the purposes of printing out a semi-intelligible model |
static Tag[] |
TAGS_SCORE_TYPE
|
Fields inherited from interface weka.core.Drawable |
BayesNet, NOT_DRAWABLE, TREE |
Constructor Summary | |
BayesNet()
|
Method Summary | |
java.lang.String |
alphaTipText()
|
void |
buildClassifier(Instances instances)
Generates the classifier. |
void |
buildStructure()
buildStructure determines the network structure/graph of the network. |
double[] |
countsForInstance(Instance instance)
Calculates the counts for Dirichlet distribution for the class membership probabilities for the given test instance. |
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test instance. |
void |
estimateCPTs()
estimateCPTs estimates the conditional probability tables for the Bayes Net using the network structure. |
double |
getAlpha()
Method declaration |
boolean |
getInitAsNaiveBayes()
Method declaration |
int |
getMaxNrOfParents()
Method declaration |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
SelectedTag |
getScoreType()
Method declaration |
boolean |
getUseADTree()
Method declaration |
java.lang.String |
graph()
Returns a BayesNet graph in XMLBIF ver 0.3 format. |
int |
graphType()
Returns the type of graph this classifier represents. |
java.lang.String |
initAsNaiveBayesTipText()
|
void |
initStructure()
Init structure initializes the structure to an empty graph or a Naive Bayes graph (depending on the -N flag). |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
double |
logScore(int nType)
logScore returns the log of the quality of a network (e.g. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.String |
maxNrOfParentsTipText()
|
java.lang.String |
scoreTypeTipText()
|
void |
setAlpha(double fAlpha)
Method declaration |
void |
setInitAsNaiveBayes(boolean bInitAsNaiveBayes)
Method declaration |
void |
setMaxNrOfParents(int nMaxNrOfParents)
Method declaration |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setScoreType(SelectedTag newScoreType)
Method declaration |
void |
setUseADTree(boolean bUseADTree)
Method declaration |
java.lang.String |
toString()
Returns a description of the classifier. |
java.lang.String |
toXMLBIF03()
Returns a description of the classifier in XML BIF 0.3 format. |
void |
updateClassifier(Instance instance)
Updates the classifier with the given instance. |
java.lang.String |
useADTreeTipText()
|
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public Instances m_Instances
public static final Tag[] TAGS_SCORE_TYPE
Constructor Detail |
public BayesNet()
Method Detail |
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 classifier has not been generated
successfullypublic void initStructure() throws java.lang.Exception
java.lang.Exception
public void buildStructure() throws java.lang.Exception
java.lang.Exception
public void estimateCPTs() throws java.lang.Exception
java.lang.Exception
public void updateClassifier(Instance instance) throws java.lang.Exception
instance
- the new training instance to include in the model
java.lang.Exception
- if the instance could not be incorporated in
the model.public double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if there is a problem generating the predictionpublic double[] countsForInstance(Instance instance) throws java.lang.Exception
instance
- the instance to be classified
java.lang.Exception
- if there is a problem generating the predictionpublic java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic void setScoreType(SelectedTag newScoreType)
public SelectedTag getScoreType()
public void setAlpha(double fAlpha)
fAlpha
- public double getAlpha()
public void setInitAsNaiveBayes(boolean bInitAsNaiveBayes)
bInitAsNaiveBayes
- public boolean getInitAsNaiveBayes()
public void setUseADTree(boolean bUseADTree)
bUseADTree
- public boolean getUseADTree()
public void setMaxNrOfParents(int nMaxNrOfParents)
nMaxNrOfParents
- public int getMaxNrOfParents()
public java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public double logScore(int nType)
nType
- score type (Bayes, MDL, etc) to calculate score with
public java.lang.String toString()
toString
in class java.lang.Object
public int graphType()
graphType
in interface Drawable
public java.lang.String graph() throws java.lang.Exception
graph
in interface Drawable
java.lang.Exception
- if the graph can't be computedpublic java.lang.String toXMLBIF03()
public java.lang.String scoreTypeTipText()
public java.lang.String alphaTipText()
public java.lang.String initAsNaiveBayesTipText()
public java.lang.String useADTreeTipText()
public java.lang.String maxNrOfParentsTipText()
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