weka.classifiers.bayes.net

## Class MarginCalculator

- java.lang.Object
- - weka.classifiers.bayes.net.MarginCalculator

- All Implemented Interfaces:
    java.io.Serializable, RevisionHandler

      public class MarginCalculator
      extends java.lang.Object
      implements java.io.Serializable, RevisionHandler

  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `MarginCalculator.JunctionTreeNode`
    `class` | `MarginCalculator.JunctionTreeSeparator`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `MarginCalculator.JunctionTreeNode` | `m_root`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MarginCalculator()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `calcFullMargins(BayesNet bayesNet)`
    `void` | `calcMargins(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)`
    `int` | `getNode(java.lang.String sNodeName)`
    `java.lang.String` | `getRevision()` Returns the revision string.
    `static void` | `main(java.lang.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.
    `void` | `process(boolean[][] bAdjacencyMatrix, BayesNet bayesNet)`
    `void` | `setEvidence(int nNode, int iValue)`
    `java.lang.String` | `toString()`
    `java.lang.String` | `toXMLBIF03()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### m_root

          public MarginCalculator.JunctionTreeNode m_root

  - ### Constructor Detail

    - #### MarginCalculator

          public MarginCalculator()

  - ### Method Detail

    - #### getNode

          public int getNode(java.lang.String sNodeName)

    - #### toXMLBIF03

          public java.lang.String toXMLBIF03()

    - #### calcMargins

          public void calcMargins(BayesNet bayesNet)
                           throws java.lang.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:
        `java.lang.Exception`

    - #### calcFullMargins

          public void calcFullMargins(BayesNet bayesNet)
                               throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### process

          public void process(boolean[][] bAdjacencyMatrix,
                              BayesNet bayesNet)
                       throws java.lang.Exception

      Throws:
        `java.lang.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 ordering
        `bAdjacencyMatrix` - boolean matrix representing the graph
      Returns:
        boolean matrix representing the graph with fill ins

    - #### setEvidence

          public void setEvidence(int nNode,
                                  int iValue)
                           throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getMargin

          public double[] getMargin(int iNode)

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Returns:
        the revision

    - #### main

          public static void main(java.lang.String[] args)