Class GlobalScoreSearchAlgorithm
java.lang.Object
weka.classifiers.bayes.net.search.SearchAlgorithm
weka.classifiers.bayes.net.search.global.GlobalScoreSearchAlgorithm
- All Implemented Interfaces:
Serializable,OptionHandler,RevisionHandler
- Direct Known Subclasses:
GeneticSearch,HillClimber,K2,SimulatedAnnealing,TAN
This Bayes Network learning algorithm uses cross
validation to estimate classification accuracy.
Valid options are:
-mbc Applies a Markov Blanket correction to the network structure, after a network structure is learned. This ensures that all nodes in the network are part of the Markov blanket of the classifier node.
-S [LOO-CV|k-Fold-CV|Cumulative-CV] Score type (LOO-CV,k-Fold-CV,Cumulative-CV)
-Q Use probabilistic or 0/1 scoring. (default probabilistic scoring)
- Version:
- $Revision: 10154 $
- Author:
- Remco Bouckaert
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleperformCV returns the accuracy calculated using cross validation.doublecalcScoreWithExtraParent(int nNode, int nCandidateParent) Calc Node Score With Added ParentdoublecalcScoreWithMissingParent(int nNode, int nCandidateParent) Calc Node Score With Parent DeleteddoublecalcScoreWithReversedParent(int nNode, int nCandidateParent) Calc Node Score With Arrow reverseddoublecumulativeCV(BayesNet bayesNet) CumulativeCV returns the accuracy calculated using cumulative cross validation.get cross validation strategy to be used in searching for networks.booleanString[]Gets the current settings of the search algorithm.Returns the revision string.booleanThis will return a string describing the search algorithm.doublekFoldCV uses k-fold cross validation to measure the accuracy of a Bayes network classifier.doubleleaveOneOutCV(BayesNet bayesNet) LeaveOneOutCV returns the accuracy calculated using Leave One Out cross validation.Returns an enumeration describing the available optionsvoidsetCVType(SelectedTag newCVType) set cross validation strategy to be used in searching for networks.voidsetMarkovBlanketClassifier(boolean bMarkovBlanketClassifier) voidsetOptions(String[] options) Parses a given list of options.voidsetUseProb(boolean useProb) Methods inherited from class weka.classifiers.bayes.net.search.SearchAlgorithm
buildStructure, initAsNaiveBayesTipText, maxNrOfParentsTipText, toString
-
Field Details
-
TAGS_CV_TYPE
the score types
-
-
Constructor Details
-
GlobalScoreSearchAlgorithm
public GlobalScoreSearchAlgorithm()
-
-
Method Details
-
calcScore
performCV returns the accuracy calculated using cross validation. The dataset used is m_Instances associated with the Bayes Network.- Parameters:
bayesNet- : Bayes Network containing structure to evaluate- Returns:
- accuracy (in interval 0..1) measured using cv.
- Throws:
Exception- whn m_nCVType is invalided + exceptions passed on by updateClassifier
-
calcScoreWithExtraParent
Calc Node Score With Added Parent- Parameters:
nNode- node for which the score is calculatenCandidateParent- candidate parent to add to the existing parent set- Returns:
- log score
- Throws:
Exception- if something goes wrong
-
calcScoreWithMissingParent
Calc Node Score With Parent Deleted- Parameters:
nNode- node for which the score is calculatenCandidateParent- candidate parent to delete from the existing parent set- Returns:
- log score
- Throws:
Exception- if something goes wrong
-
calcScoreWithReversedParent
Calc Node Score With Arrow reversed- Parameters:
nNode- node for which the score is calculatenCandidateParent- candidate parent to delete from the existing parent set- Returns:
- log score
- Throws:
Exception- if something goes wrong
-
leaveOneOutCV
LeaveOneOutCV returns the accuracy calculated using Leave One Out cross validation. The dataset used is m_Instances associated with the Bayes Network.- Parameters:
bayesNet- : Bayes Network containing structure to evaluate- Returns:
- accuracy (in interval 0..1) measured using leave one out cv.
- Throws:
Exception- passed on by updateClassifier
-
cumulativeCV
CumulativeCV returns the accuracy calculated using cumulative cross validation. The idea is to run through the data set and try to classify each of the instances based on the previously seen data. The data set used is m_Instances associated with the Bayes Network.- Parameters:
bayesNet- : Bayes Network containing structure to evaluate- Returns:
- accuracy (in interval 0..1) measured using leave one out cv.
- Throws:
Exception- passed on by updateClassifier
-
kFoldCV
kFoldCV uses k-fold cross validation to measure the accuracy of a Bayes network classifier.- Parameters:
bayesNet- : Bayes Network containing structure to evaluatenNrOfFolds- : the number of folds k to perform k-fold cv- Returns:
- accuracy (in interval 0..1) measured using leave one out cv.
- Throws:
Exception- passed on by updateClassifier
-
getUseProb
public boolean getUseProb()- Returns:
- use probabilities or not in accuracy estimate
-
setUseProb
public void setUseProb(boolean useProb) - Parameters:
useProb- : use probabilities or not in accuracy estimate
-
setCVType
set cross validation strategy to be used in searching for networks.- Parameters:
newCVType- : cross validation strategy
-
getCVType
get cross validation strategy to be used in searching for networks.- Returns:
- cross validation strategy
-
setMarkovBlanketClassifier
public void setMarkovBlanketClassifier(boolean bMarkovBlanketClassifier) - Parameters:
bMarkovBlanketClassifier-
-
getMarkovBlanketClassifier
public boolean getMarkovBlanketClassifier()- Returns:
-
listOptions
Returns an enumeration describing the available options- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classSearchAlgorithm- Returns:
- an enumeration of all the available options
-
setOptions
Parses a given list of options. Valid options are:-mbc Applies a Markov Blanket correction to the network structure, after a network structure is learned. This ensures that all nodes in the network are part of the Markov blanket of the classifier node.
-S [LOO-CV|k-Fold-CV|Cumulative-CV] Score type (LOO-CV,k-Fold-CV,Cumulative-CV)
-Q Use probabilistic or 0/1 scoring. (default probabilistic scoring)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classSearchAlgorithm- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
Gets the current settings of the search algorithm.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classSearchAlgorithm- Returns:
- an array of strings suitable for passing to setOptions
-
CVTypeTipText
- Returns:
- a string to describe the CVType option.
-
useProbTipText
- Returns:
- a string to describe the UseProb option.
-
globalInfo
This will return a string describing the search algorithm.- Returns:
- The string.
-
markovBlanketClassifierTipText
- Returns:
- a string to describe the MarkovBlanketClassifier option.
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classSearchAlgorithm- Returns:
- the revision
-