weka.classifiers.bayes
Class BayesNet
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.bayes.BayesNet
- All Implemented Interfaces:
- AdditionalMeasureProducer, java.lang.Cloneable, Drawable, OptionHandler, java.io.Serializable, WeightedInstancesHandler
- Direct Known Subclasses:
- BayesNetGenerator, BIFReader
- public class BayesNet
- extends Classifier
- implements OptionHandler, WeightedInstancesHandler, Drawable, AdditionalMeasureProducer
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.
For further documentation, see
toXMLBIF03
public java.lang.String toXMLBIF03()
- Returns a description of the classifier in XML BIF 0.3 format.
See http://www-2.cs.cmu.edu/~fgcozman/Research/InterchangeFormat/
for details on XML BIF.
- Returns:
- an XML BIF 0.3 description of the classifier as a string.
useADTreeTipText
public java.lang.String useADTreeTipText()
- Returns:
- a string to describe the UseADTreeoption.
searchAlgorithmTipText
public java.lang.String searchAlgorithmTipText()
- Returns:
- a string to describe the SearchAlgorithm.
estimatorTipText
public java.lang.String estimatorTipText()
- This will return a string describing the BayesNetEstimator.
- Returns:
- The string.
BIFFileTipText
public java.lang.String BIFFileTipText()
- Returns:
- a string to describe the BIFFile.
globalInfo
public java.lang.String globalInfo()
- This will return a string describing the classifier.
- Returns:
- The string.
main
public static void main(java.lang.String[] argv)
- Main method for testing this class.
- Parameters:
argv
- the options
getName
public java.lang.String getName()
- get name of the Bayes network
- Returns:
- name of the Bayes net
getNrOfNodes
public int getNrOfNodes()
- get number of nodes in the Bayes network
- Returns:
- number of nodes
getNodeName
public java.lang.String getNodeName(int iNode)
- get name of a node in the Bayes network
- Returns:
- name of the specified node
getCardinality
public int getCardinality(int iNode)
- get number of values a node can take
- Returns:
- cardinality of the specified node
getNodeValue
public java.lang.String getNodeValue(int iNode,
int iValue)
- get name of a particular value of a node
- Returns:
- cardinality of the specified node
getNrOfParents
public int getNrOfParents(int iNode)
- get number of parents of a node in the network structure
- Returns:
- number of parents of the specified node
getParent
public int getParent(int iNode,
int iParent)
- get node index of a parent of a node in the network structure
- Returns:
- node index of the iParent's parent of the specified node
getParentSets
public ParentSet[] getParentSets()
- Get full set of parent sets.
- Returns:
- parent sets;
getDistributions
public Estimator[][] getDistributions()
- Get full set of estimators.
- Returns:
- estimators;
getParentCardinality
public int getParentCardinality(int iNode)
- get number of values the collection of parents of a node can take
- Returns:
- cardinality of the parent set of the specified node
getProbability
public double getProbability(int iNode,
int iParent,
int iValue)
- get particular probability of the conditional probability distribtion
of a node given its parents.
- Returns:
- probability
getParentSet
public ParentSet getParentSet(int iNode)
- get the parent set of a node
- Returns:
- Parent set of the specified node.
getADTree
public ADNode getADTree()
- get ADTree strucrture containing efficient representation of counts.
- Returns:
- ADTree strucrture
enumerateMeasures
public java.util.Enumeration enumerateMeasures()
- Returns an enumeration of the measure names. Additional measures
must follow the naming convention of starting with "measure", eg.
double measureBlah()
- Specified by:
enumerateMeasures
in interface AdditionalMeasureProducer
- Returns:
- an enumeration of the measure names
measureExtraArcs
public double measureExtraArcs()
measureMissingArcs
public double measureMissingArcs()
measureReversedArcs
public double measureReversedArcs()
measureDivergence
public double measureDivergence()
measureBayesScore
public double measureBayesScore()
measureBDeuScore
public double measureBDeuScore()
measureMDLScore
public double measureMDLScore()
measureAICScore
public double measureAICScore()
measureEntropyScore
public double measureEntropyScore()
getMeasure
public double getMeasure(java.lang.String measureName)
- Returns the value of the named measure
- Specified by:
getMeasure
in interface AdditionalMeasureProducer
- Parameters:
measureName
- the name of the measure to query for its value
- Returns:
- the value of the named measure
- Throws:
java.lang.IllegalArgumentException
- if the named measure is not supported