| java.lang.Object weka.classifiers.bayes.net.search.SearchAlgorithm
All known Subclasses: weka.classifiers.bayes.net.search.local.LocalScoreSearchAlgorithm, weka.classifiers.bayes.net.search.fixed.NaiveBayes, weka.classifiers.bayes.net.search.global.GlobalScoreSearchAlgorithm, weka.classifiers.bayes.net.search.fixed.FromFile,
SearchAlgorithm | public class SearchAlgorithm implements OptionHandler,Serializable(Code) | | This is the base class for all search algorithms for learning Bayes networks.
It contains some common code, used by other network structure search algorithms,
and should not be used by itself.
author: Remco Bouckaert version: $Revision: 1.7 $ |
Method Summary | |
protected boolean | addArcMakesSense(BayesNet bayesNet, Instances instances, int iAttributeHead, int iAttributeTail) | public void | buildStructure(BayesNet bayesNet, Instances instances) buildStructure determines the network structure/graph of the network. | protected void | doMarkovBlanketCorrection(BayesNet bayesNet, Instances instances) for each node in the network make sure it is in the
Markov blanket of the classifier node, and if not,
add arrows so that it is. | protected boolean | getMarkovBlanketClassifier() | public String[] | getOptions() Gets the current settings of the Classifier. | public String | initAsNaiveBayesTipText() | protected boolean | isArc(BayesNet bayesNet, int iAttributeHead, int iAttributeTail) | public Enumeration | listOptions() Returns an enumeration describing the available options. | protected String | markovBlanketClassifierTipText() | public String | maxNrOfParentsTipText() | protected boolean | reverseArcMakesSense(BayesNet bayesNet, Instances instances, int iAttributeHead, int iAttributeTail) | protected void | search(BayesNet bayesNet, Instances instances) | protected void | setMarkovBlanketClassifier(boolean bMarkovBlanketClassifier) | public void | setOptions(String[] options) Parses a given list of options. | public String | toString() |
m_bInitAsNaiveBayes | protected boolean m_bInitAsNaiveBayes(Code) | | determines whether initial structure is an empty graph or a Naive Bayes network
|
m_bMarkovBlanketClassifier | protected boolean m_bMarkovBlanketClassifier(Code) | | Determines whether after structure is found a MarkovBlanketClassifier correction should be applied
If this is true, m_bInitAsNaiveBayes is overridden and interpreted as false.
|
m_nMaxNrOfParents | protected int m_nMaxNrOfParents(Code) | | Holds upper bound on number of parents
|
serialVersionUID | final static long serialVersionUID(Code) | | for serialization
|
SearchAlgorithm | public SearchAlgorithm()(Code) | | c'tor *
|
addArcMakesSense | protected boolean addArcMakesSense(BayesNet bayesNet, Instances instances, int iAttributeHead, int iAttributeTail)(Code) | | AddArcMakesSense checks whether adding the arc from iAttributeTail to iAttributeHead
does not already exists and does not introduce a cycle
Parameters: bayesNet - Parameters: instances - Parameters: iAttributeHead - index of the attribute that becomes head of the arrow Parameters: iAttributeTail - index of the attribute that becomes tail of the arrow true if adding arc is allowed, otherwise false |
buildStructure | public void buildStructure(BayesNet bayesNet, Instances instances) throws Exception(Code) | | buildStructure determines the network structure/graph of the network.
The default behavior is creating a network where all nodes have the first
node as its parent (i.e., a BayesNet that behaves like a naive Bayes classifier).
This method can be overridden by derived classes to restrict the class
of network structures that are acceptable.
Parameters: bayesNet - the network Parameters: instances - the data to use throws: Exception - if something goes wrong |
doMarkovBlanketCorrection | protected void doMarkovBlanketCorrection(BayesNet bayesNet, Instances instances)(Code) | | for each node in the network make sure it is in the
Markov blanket of the classifier node, and if not,
add arrows so that it is. If the node is an ancestor
of the classifier node, add arrow pointing to the classifier
node, otherwise, add arrow pointing to attribute node.
Parameters: bayesNet - Parameters: instances - |
getMarkovBlanketClassifier | protected boolean getMarkovBlanketClassifier()(Code) | | |
getOptions | public String[] getOptions()(Code) | | Gets the current settings of the Classifier.
an array of strings suitable for passing to setOptions |
initAsNaiveBayesTipText | public String initAsNaiveBayesTipText()(Code) | | a string to describe the InitAsNaiveBayes option. |
isArc | protected boolean isArc(BayesNet bayesNet, int iAttributeHead, int iAttributeTail)(Code) | | IsArc checks whether the arc from iAttributeTail to iAttributeHead already exists
Parameters: bayesNet - Parameters: iAttributeHead - index of the attribute that becomes head of the arrow Parameters: iAttributeTail - index of the attribute that becomes tail of the arrow true if the arc from iAttributeTail to iAttributeHead already exists |
listOptions | public Enumeration listOptions()(Code) | | Returns an enumeration describing the available options.
an enumeration of all the available options. |
markovBlanketClassifierTipText | protected String markovBlanketClassifierTipText()(Code) | | a string to describe the MarkovBlanketClassifier option. |
maxNrOfParentsTipText | public String maxNrOfParentsTipText()(Code) | | a string to describe the MaxNrOfParentsoption. |
reverseArcMakesSense | protected boolean reverseArcMakesSense(BayesNet bayesNet, Instances instances, int iAttributeHead, int iAttributeTail)(Code) | | reverseArcMakesSense checks whether the arc from iAttributeTail to
iAttributeHead exists and reversing does not introduce a cycle
Parameters: bayesNet - Parameters: instances - Parameters: iAttributeHead - index of the attribute that is head of the arrow Parameters: iAttributeTail - index of the attribute that is tail of the arrow true if the arc from iAttributeTail to iAttributeHead exists and reversing does not introduce a cycle |
setMarkovBlanketClassifier | protected void setMarkovBlanketClassifier(boolean bMarkovBlanketClassifier)(Code) | | Parameters: bMarkovBlanketClassifier - |
setOptions | public void setOptions(String[] options) throws Exception(Code) | | Parses a given list of options.
Parameters: options - the list of options as an array of strings throws: Exception - if an option is not supported |
toString | public String toString()(Code) | | a string representation of the algorithm
a string representation |
|
|