edu.ksu.cis.bnj.bbn.inference.approximate.sampling
Class LogicSampling

java.lang.Object
  extended byedu.ksu.cis.bnj.bbn.inference.Inference
      extended byedu.ksu.cis.bnj.bbn.inference.ApproximateInference
          extended byedu.ksu.cis.bnj.bbn.inference.approximate.sampling.MCMC
              extended byedu.ksu.cis.bnj.bbn.inference.approximate.sampling.LogicSampling
All Implemented Interfaces:
DataGenerator, Optionable

public class LogicSampling
extends MCMC

Logic sampling gets samples by instantiating each node of the network (using the likelihood of each state given the state of the parent nodes) in topological order. Evidence nodes are sampled just like query nodes. nodes does not match the evidence file. Approximate probabilities are computed by looking at how many times each state for each node appeared in the satisfactory samples.

Author:
Roby Joehanes

Field Summary
 
Fields inherited from class edu.ksu.cis.bnj.bbn.inference.approximate.sampling.MCMC
abort, abortTimer, defaultMaxIteration, generateSamples, listeners, maxIteration, NO_TIME_LIMIT, OPT_GENERATE_DATA, OPT_MAX_ITERATION, OPT_RUNNING_TIME_LIMIT, OPT_USE_MARKOV_BLANKET, random, runningTimeLimit, tuples, useMarkovBlanketScore
 
Fields inherited from class edu.ksu.cis.bnj.bbn.inference.ApproximateInference
rmseWriter
 
Fields inherited from class edu.ksu.cis.bnj.bbn.inference.Inference
graph, inferenceClassName, MAP, MARGINALS, marginalsResult, MPE, OPT_RUN_TYPE, options
 
Fields inherited from interface edu.ksu.cis.kdd.util.gui.Optionable
OPT_OUTPUT_FILE
 
Constructor Summary
LogicSampling()
           
LogicSampling(BBNGraph g)
          The constructor for LogicSampling, which initializes the graph on which to run inference.
LogicSampling(BBNGraph g, int i)
          An alternate constructor, which intializes the graph on which to run inference and the number of samples to use
 
Method Summary
 InferenceResult getMarginals()
          Computes the LogicSampling algorithm and calculates the posterior probabilities of the network
 java.lang.String getName()
          Gets the name of the inference algorithm
static void main(java.lang.String[] args)
           
 
Methods inherited from class edu.ksu.cis.bnj.bbn.inference.approximate.sampling.MCMC
abort, addListener, cancelAbortTimer, generateData, generateData, getData, getDefaultOptions, getMarkovBlanketScore, getMaxIteration, getOptionsDialog, getRunningTimeLimit, isUseMarkovBlanketScore, removeListener, sendEvent, setAbortTimer, setMaxIteration, setRunningTimeLimit, setUseMarkovBlanketScore
 
Methods inherited from class edu.ksu.cis.bnj.bbn.inference.ApproximateInference
computeRMSE, getRMSEWriter, setRMSEfile
 
Methods inherited from class edu.ksu.cis.bnj.bbn.inference.Inference
execute, getCurrentOptions, getGraph, getMAP, getMarginalsResult, getMPE, getOutputFile, getRunType, load, setGraph, setOption, setOptions, setOutputFile, setRunType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogicSampling

public LogicSampling()

LogicSampling

public LogicSampling(BBNGraph g)
The constructor for LogicSampling, which initializes the graph on which to run inference.

Parameters:
g - - the BBNGraph on which to run inference

LogicSampling

public LogicSampling(BBNGraph g,
                     int i)
An alternate constructor, which intializes the graph on which to run inference and the number of samples to use

Parameters:
g - - the BBNGraph on which to run inference
i - - the number of samples to generate during inference
Method Detail

getName

public java.lang.String getName()
Gets the name of the inference algorithm

Specified by:
getName in interface DataGenerator
Specified by:
getName in class Inference
Returns:
String - the name of the inference algorithm (LogicSampling)

getMarginals

public InferenceResult getMarginals()
Computes the LogicSampling algorithm and calculates the posterior probabilities of the network

Specified by:
getMarginals in class Inference
Returns:
InferenceResult - contains the posterior probs
See Also:
edu.ksu.cis.bnj.bbn.inference.approximate.sampling.MCMC#getMarginalsImpl(boolean)

main

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