public class LocalScoreSearchAlgorithm extends SearchAlgorithm
-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)
| Modifier and Type | Field and Description |
|---|---|
static Tag[] |
TAGS_SCORE_TYPE
the score types
|
m_bInitAsNaiveBayes, m_bMarkovBlanketClassifier, m_nMaxNrOfParents, m_sInitalBIFFile| Constructor and Description |
|---|
LocalScoreSearchAlgorithm()
default constructor
|
LocalScoreSearchAlgorithm(BayesNet bayesNet,
Instances instances)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
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 set
|
protected double |
calcScoreOfCounts(int[] nCounts,
int nCardinality,
int numValues,
Instances instances)
utility function used by CalcScore and CalcNodeScore to determine the score based on observed frequencies.
|
protected double |
calcScoreOfCounts2(int[][] nCounts,
int nCardinality,
int numValues,
Instances instances) |
double |
calcScoreWithExtraParent(int nNode,
int nCandidateParent)
Calc Node Score With AddedParent
|
double |
calcScoreWithMissingParent(int nNode,
int nCandidateParent)
Calc Node Score With Parent Deleted
|
boolean |
getMarkovBlanketClassifier() |
java.lang.String[] |
getOptions()
Gets the current settings of the search algorithm.
|
java.lang.String |
getRevision()
Returns the revision string.
|
SelectedTag |
getScoreType()
get quality measure to be used in searching for networks.
|
java.lang.String |
globalInfo()
This will return a string describing the search algorithm.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options
|
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).
|
java.lang.String |
markovBlanketClassifierTipText() |
java.lang.String |
scoreTypeTipText() |
void |
setMarkovBlanketClassifier(boolean bMarkovBlanketClassifier) |
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setScoreType(SelectedTag newScoreType)
set quality measure to be used in searching for networks.
|
addArcMakesSense, doMarkovBlanketCorrection, initAsNaiveBayesTipText, isArc, maxNrOfParentsTipText, reverseArcMakesSense, search, toStringpublic static final Tag[] TAGS_SCORE_TYPE
public double logScore(int nType)
nType - score type (Bayes, MDL, etc) to calculate score withpublic void buildStructure(BayesNet bayesNet, Instances instances) throws java.lang.Exception
buildStructure in class SearchAlgorithmbayesNet - the networkinstances - the data to usejava.lang.Exception - if something goes wrongpublic double calcNodeScore(int nNode)
throws java.lang.InterruptedException
nNode - node for which the score is calculatejava.lang.InterruptedExceptionprotected double calcScoreOfCounts(int[] nCounts,
int nCardinality,
int numValues,
Instances instances)
throws java.lang.InterruptedException
nCounts - array with observed frequenciesnCardinality - ardinality of parent setnumValues - number of values a node can takeinstances - to calc score withjava.lang.InterruptedExceptionprotected double calcScoreOfCounts2(int[][] nCounts,
int nCardinality,
int numValues,
Instances instances)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic double calcScoreWithExtraParent(int nNode,
int nCandidateParent)
throws java.lang.InterruptedException
nNode - node for which the score is calculatenCandidateParent - candidate parent to add to the existing parent setjava.lang.InterruptedExceptionpublic double calcScoreWithMissingParent(int nNode,
int nCandidateParent)
throws java.lang.InterruptedException
nNode - node for which the score is calculatenCandidateParent - candidate parent to delete from the existing parent setjava.lang.InterruptedExceptionpublic void setScoreType(SelectedTag newScoreType)
newScoreType - the new score typepublic SelectedTag getScoreType()
public void setMarkovBlanketClassifier(boolean bMarkovBlanketClassifier)
setMarkovBlanketClassifier in class SearchAlgorithmbMarkovBlanketClassifier - public boolean getMarkovBlanketClassifier()
getMarkovBlanketClassifier in class SearchAlgorithmpublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class SearchAlgorithmpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-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)
setOptions in interface OptionHandlersetOptions in class SearchAlgorithmoptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SearchAlgorithmpublic java.lang.String scoreTypeTipText()
public java.lang.String markovBlanketClassifierTipText()
markovBlanketClassifierTipText in class SearchAlgorithmpublic java.lang.String globalInfo()
public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class SearchAlgorithm