Class LocalScoreSearchAlgorithm
java.lang.Object
weka.classifiers.bayes.net.search.SearchAlgorithm
weka.classifiers.bayes.net.search.local.LocalScoreSearchAlgorithm
- All Implemented Interfaces:
Serializable
,OptionHandler
,RevisionHandler
- Direct Known Subclasses:
CISearchAlgorithm
,GeneticSearch
,HillClimber
,K2
,SimulatedAnnealing
,TAN
The ScoreBasedSearchAlgorithm class supports Bayes
net structure search algorithms that are based on maximizing scores (as
opposed to for example conditional independence based search algorithms).
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 [BAYES|MDL|ENTROPY|AIC|CROSS_CLASSIC|CROSS_BAYES] Score type (BAYES, BDeu, MDL, ENTROPY and AIC)
- Version:
- $Revision: 10378 $
- Author:
- Remco Bouckaert
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptiondefault constructorLocalScoreSearchAlgorithm
(BayesNet bayesNet, Instances instances) constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildStructure
(BayesNet bayesNet, Instances instances) 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.double
calcNodeScore
(int nNode) Calc Node Score for given parent setdouble
calcScoreWithExtraParent
(int nNode, int nCandidateParent) Calc Node Score With AddedParentdouble
calcScoreWithMissingParent
(int nNode, int nCandidateParent) Calc Node Score With Parent Deletedboolean
String[]
Gets the current settings of the search algorithm.Returns the revision string.get quality measure to be used in searching for networks.This will return a string describing the search algorithm.Returns an enumeration describing the available optionsdouble
logScore
(int nType) logScore returns the log of the quality of a network (e.g.void
setMarkovBlanketClassifier
(boolean bMarkovBlanketClassifier) void
setOptions
(String[] options) Parses a given list of options.void
setScoreType
(SelectedTag newScoreType) set quality measure to be used in searching for networks.Methods inherited from class weka.classifiers.bayes.net.search.SearchAlgorithm
initAsNaiveBayesTipText, maxNrOfParentsTipText, toString
-
Field Details
-
TAGS_SCORE_TYPE
the score types
-
-
Constructor Details
-
LocalScoreSearchAlgorithm
public LocalScoreSearchAlgorithm()default constructor -
LocalScoreSearchAlgorithm
constructor- Parameters:
bayesNet
- the networkinstances
- the data
-
-
Method Details
-
logScore
public double logScore(int nType) logScore returns the log of the quality of a network (e.g. the posterior probability of the network, or the MDL value).- Parameters:
nType
- score type (Bayes, MDL, etc) to calculate score with- Returns:
- log score.
-
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.- Overrides:
buildStructure
in classSearchAlgorithm
- Parameters:
bayesNet
- the networkinstances
- the data to use- Throws:
Exception
- if something goes wrong
-
calcNodeScore
public double calcNodeScore(int nNode) Calc Node Score for given parent set- Parameters:
nNode
- node for which the score is calculate- Returns:
- log score
-
calcScoreWithExtraParent
public double calcScoreWithExtraParent(int nNode, int nCandidateParent) Calc Node Score With AddedParent- Parameters:
nNode
- node for which the score is calculatenCandidateParent
- candidate parent to add to the existing parent set- Returns:
- log score
-
calcScoreWithMissingParent
public double calcScoreWithMissingParent(int nNode, int nCandidateParent) 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
-
setScoreType
set quality measure to be used in searching for networks.- Parameters:
newScoreType
- the new score type
-
getScoreType
get quality measure to be used in searching for networks.- Returns:
- quality measure
-
setMarkovBlanketClassifier
public void setMarkovBlanketClassifier(boolean bMarkovBlanketClassifier) - Parameters:
bMarkovBlanketClassifier
-
-
getMarkovBlanketClassifier
public boolean getMarkovBlanketClassifier()- Returns:
-
listOptions
Returns an enumeration describing the available options- Specified by:
listOptions
in interfaceOptionHandler
- Overrides:
listOptions
in 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 [BAYES|MDL|ENTROPY|AIC|CROSS_CLASSIC|CROSS_BAYES] Score type (BAYES, BDeu, MDL, ENTROPY and AIC)
- Specified by:
setOptions
in interfaceOptionHandler
- Overrides:
setOptions
in 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:
getOptions
in interfaceOptionHandler
- Overrides:
getOptions
in classSearchAlgorithm
- Returns:
- an array of strings suitable for passing to setOptions
-
scoreTypeTipText
- Returns:
- a string to describe the ScoreType option.
-
markovBlanketClassifierTipText
- Returns:
- a string to describe the MarkovBlanketClassifier option.
-
globalInfo
This will return a string describing the search algorithm.- Returns:
- The string.
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classSearchAlgorithm
- Returns:
- the revision
-