blog
Class UrnBallsSplitMerge

java.lang.Object
  extended by blog.UrnBallsSplitMerge
All Implemented Interfaces:
Proposer

public class UrnBallsSplitMerge
extends java.lang.Object
implements Proposer

Split-merge proposal distribution for the urn-and-balls model.


Constructor Summary
UrnBallsSplitMerge(Model model, java.util.Properties properties)
          Creates a new UrnBallSplitMerge proposer for the given model.
 
Method Summary
 PartialWorldDiff initialize(Evidence evidence, java.util.List queries)
          Sets up the given PartialWorldDiff to serve as the initial state of a Markov chain.
 void printStats()
          Prints any relevant statistics about the internal behavior of this proposer.
 double proposeNextState(PartialWorldDiff proposedWorld)
          Proposes a next state for the Markov chain given the current state.
 void updateStats(boolean accepted)
          Updates any statistics maintained by this proposer to reflect the fact that the most recent proposal was accepted (if accepted is true) or rejected (if accepted is false).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrnBallsSplitMerge

public UrnBallsSplitMerge(Model model,
                          java.util.Properties properties)
Creates a new UrnBallSplitMerge proposer for the given model.

Method Detail

initialize

public PartialWorldDiff initialize(Evidence evidence,
                                   java.util.List queries)
Sets up the given PartialWorldDiff to serve as the initial state of a Markov chain. In this world, each draw yields a distinct ball, and the total number of balls equals the number of draws.

Specified by:
initialize in interface Proposer
queries - List of Query objects

proposeNextState

public double proposeNextState(PartialWorldDiff proposedWorld)
Proposes a next state for the Markov chain given the current state. The world argument is a PartialWorldDiff that the proposer can modify to create the proposal; the saved version of this PartialWorldDiff is the state before the proposal. Returns the log proposal ratio: log (q(x | x') / q(x' | x))

This method implements a split-merge proposal distribution. Two draws are chosen uniformly without replacement from the set of draws. If these two draws both yielded the same ball, that ball is "split" (its draws are reassigned randomly to that ball and a new ball) and new colors are sampled for that ball and the new ball. If the two draws yielded different balls, those balls are "merged" (one is deleted and all its draws are moved to the other ball) and a new color is sampled for the remaining ball. Note that these split-merge moves increase or decrease the number of balls in the world, so the number of unused balls stays constant.

There is also another move type that changes the total number of balls without changing the values of any BallDrawn variables. We do this type of move with probability NUM_BALLS_MOVE_PROB.

The log proposal ratio returned is specific to the chosen move type, and the chosen draws for a split-merge move. That is, we don't compute the probability of making the same proposal through a different move type or a different choice of draws. This is ok because each move type or choice of draws can be thought of as a separate MCMC kernel; we're just mixing these kernels together.

Specified by:
proposeNextState in interface Proposer

updateStats

public void updateStats(boolean accepted)
Description copied from interface: Proposer
Updates any statistics maintained by this proposer to reflect the fact that the most recent proposal was accepted (if accepted is true) or rejected (if accepted is false).

Specified by:
updateStats in interface Proposer

printStats

public void printStats()
Description copied from interface: Proposer
Prints any relevant statistics about the internal behavior of this proposer.

Specified by:
printStats in interface Proposer