Class BOAsampler


  • public class BOAsampler
    extends Object
    Used to sample data from a learnt Bayesian Network.

    Algorithm description: First the root node (i.e the node having no parents) is assigned a data value according to the probability parameters encoded in the network. Then, the children of the node are assigned values (given the parent node value) using conditional probability parameters. This process continues until all nodes are assigned some value.

    The whole process is repeated as many times as we want the number of offspring.

    • Constructor Detail

      • BOAsampler

        public BOAsampler​(int[][] Graph,
                          int[][] DataMatrix)
        Constructor for the class.
        Parameters:
        Graph - - An adjacency matrix representing the network/graph
        DataMatrix - - A matrix containing the data
    • Method Detail

      • main

        public static void main​(String[] args)
      • sample

        public int[][] sample​(int NumberOfSamples)
        Method to sample solutions/offspring/data-points from the Bayesian Network.
        Parameters:
        NumberOfSamples - - The number of data-points/offspring one wants from the learnt Bayesian Network.
        Returns:
        A matrix containing the sampled offspring/data-points. Each row corresponds to an offspring/data-point.
      • getAllParents

        public ArrayList<Integer> getAllParents​(int[][] Graph)
        Gives a list of all root nodes in the network/graph. Root nodes are those nodes which don't have any other node as its parent.
        Parameters:
        Graph - - An adjacency matrix of the network/graph.
        Returns:
        An ArrayList of Integer values. The integer values correspond to the indices of the root nodes.