weka.classifiers.bayes
Class BayesNetK2

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.bayes.BayesNet
          extended byweka.classifiers.bayes.BayesNetK2
All Implemented Interfaces:
java.lang.Cloneable, Drawable, OptionHandler, java.io.Serializable, WeightedInstancesHandler

public class BayesNetK2
extends BayesNet

Class for a Bayes Network classifier based on K2 for learning structure. K2 is a hill climbing algorihtm by Greg Cooper and Ed Herskovitz, Proceedings Uncertainty in Artificial Intelligence, 1991, Also in Machine Learning, 1992 pages 309-347. Works with nominal variables and no missing values only.

Version:
$Revision: 1.3 $
Author:
Remco Bouckaert (rrb@xm.co.nz)
See Also:
Serialized Form

Field Summary
(package private)  boolean m_bRandomOrder
          Holds flag to indicate ordering should be random
 
Fields inherited from class weka.classifiers.bayes.BayesNet
m_ADTree, m_bInitAsNaiveBayes, m_bUseADTree, m_Distributions, m_fAlpha, m_Instances, m_nMaxNrOfParents, m_nOrder, m_nScoreType, m_NumClasses, m_ParentSets, TAGS_SCORE_TYPE
 
Fields inherited from class weka.classifiers.Classifier
m_Debug
 
Fields inherited from interface weka.core.Drawable
BayesNet, NOT_DRAWABLE, TREE
 
Constructor Summary
BayesNetK2()
           
 
Method Summary
 void buildStructure()
          buildStructure determines the network structure/graph of the network with the K2 algorithm, restricted by its initial structure (which can be an empty graph, or a Naive Bayes graph.
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 boolean getRandomOrder()
          Get random order flag
 java.lang.String globalInfo()
          This will return a string describing the classifier.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] argv)
          Main method for testing this class.
 java.lang.String randomOrderTipText()
           
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setRandomOrder(boolean bRandomOrder)
          Set random order flag
 
Methods inherited from class weka.classifiers.bayes.BayesNet
alphaTipText, buildClassifier, CalcNodeScore, CalcScoreOfCounts, CalcScoreOfCounts2, CalcScoreWithExtraParent, countsForInstance, distributionForInstance, estimateCPTs, getAlpha, getInitAsNaiveBayes, getMaxNrOfParents, getScoreType, getUseADTree, graph, graphType, initAsNaiveBayesTipText, initStructure, logScore, maxNrOfParentsTipText, scoreTypeTipText, setAlpha, setInitAsNaiveBayes, setMaxNrOfParents, setScoreType, setUseADTree, toString, toXMLBIF03, updateClassifier, useADTreeTipText, XMLNormalize
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_bRandomOrder

boolean m_bRandomOrder
Holds flag to indicate ordering should be random

Constructor Detail

BayesNetK2

public BayesNetK2()
Method Detail

buildStructure

public void buildStructure()
                    throws java.lang.Exception
buildStructure determines the network structure/graph of the network with the K2 algorithm, restricted by its initial structure (which can be an empty graph, or a Naive Bayes graph.

Overrides:
buildStructure in class BayesNet
Throws:
java.lang.Exception

setRandomOrder

public void setRandomOrder(boolean bRandomOrder)
Set random order flag

Parameters:
bRandomOrder -

getRandomOrder

public boolean getRandomOrder()
Get random order flag


listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Overrides:
listOptions in class BayesNet
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options. Valid options are:

-R Set the random order to true (default false).

For other options see bagging.

Specified by:
setOptions in interface OptionHandler
Overrides:
setOptions in class BayesNet
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface OptionHandler
Overrides:
getOptions in class BayesNet
Returns:
an array of strings suitable for passing to setOptions

randomOrderTipText

public java.lang.String randomOrderTipText()
Returns:
a string to describe the RandomOrder option.

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