Package weka.classifiers.bayes.net
Class MarginCalculator
- java.lang.Object
-
- weka.classifiers.bayes.net.MarginCalculator
-
- All Implemented Interfaces:
Serializable,RevisionHandler
public class MarginCalculator extends Object implements Serializable, RevisionHandler
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMarginCalculator.JunctionTreeNodeclassMarginCalculator.JunctionTreeSeparator
-
Field Summary
Fields Modifier and Type Field Description MarginCalculator.JunctionTreeNodem_root
-
Constructor Summary
Constructors Constructor Description MarginCalculator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalcFullMargins(BayesNet bayesNet)voidcalcMargins(BayesNet bayesNet)Calc marginal distributions of nodes in Bayesian network Note that a connected network is assumed.boolean[][]fillIn(int[] order, boolean[][] bAdjacencyMatrix)Apply Tarjan and Yannakakis (1984) fill in algorithm for graph triangulation.double[]getMargin(int iNode)intgetNode(String sNodeName)StringgetRevision()Returns the revision string.static voidmain(String[] args)boolean[][]moralize(BayesNet bayesNet)moralize DAG and calculate adjacency matrix representation for a Bayes Network, effecively converting the directed acyclic graph to an undirected graph.voidprocess(boolean[][] bAdjacencyMatrix, BayesNet bayesNet)voidsetEvidence(int nNode, int iValue)StringtoString()StringtoXMLBIF03()
-
-
-
Field Detail
-
m_root
public MarginCalculator.JunctionTreeNode m_root
-
-
Method Detail
-
getNode
public int getNode(String sNodeName)
-
toXMLBIF03
public String toXMLBIF03()
-
calcMargins
public void calcMargins(BayesNet bayesNet) throws Exception
Calc marginal distributions of nodes in Bayesian network Note that a connected network is assumed. Unconnected networks may give unexpected results.- Parameters:
bayesNet-- Throws:
Exception
-
process
public void process(boolean[][] bAdjacencyMatrix, BayesNet bayesNet) throws Exception- Throws:
Exception
-
moralize
public boolean[][] moralize(BayesNet bayesNet)
moralize DAG and calculate adjacency matrix representation for a Bayes Network, effecively converting the directed acyclic graph to an undirected graph.- Parameters:
bayesNet- Bayes Network to process- Returns:
- adjacencies in boolean matrix format
-
fillIn
public boolean[][] fillIn(int[] order, boolean[][] bAdjacencyMatrix)Apply Tarjan and Yannakakis (1984) fill in algorithm for graph triangulation. In reverse order, insert edges between any non-adjacent neighbors that are lower numbered in the ordering. Side effect: input matrix is used as output- Parameters:
order- node orderingbAdjacencyMatrix- boolean matrix representing the graph- Returns:
- boolean matrix representing the graph with fill ins
-
getMargin
public double[] getMargin(int iNode)
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
main
public static void main(String[] args)
-
-