org.omegahat.Simulation.MCMC
Class CustomMetropolisHastingsSampler
java.lang.Object
|
+--org.omegahat.Simulation.MCMC.NotifyingMCMCObject
|
+--org.omegahat.Simulation.MCMC.BaseMarkovChain
|
+--org.omegahat.Simulation.MCMC.CustomMarkovChain
|
+--org.omegahat.Simulation.MCMC.CustomMetropolisHastingsSampler
- All Implemented Interfaces:
- MarkovChain, NotifyingObject, java.lang.Runnable
- Direct Known Subclasses:
- CustomMetropolisSampler
- public class CustomMetropolisHastingsSampler
- extends CustomMarkovChain
A Markov Sampler that uses an internal
GenericProposal
and UnnormalizedDensity
to generate the next Markov state.
Constructor Summary |
protected |
CustomMetropolisHastingsSampler()
|
|
CustomMetropolisHastingsSampler(ContainerState state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng)
Generate GenericChainStepEvent s at each step |
|
CustomMetropolisHastingsSampler(ContainerState state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng,
boolean detailed)
Default constructor |
|
CustomMetropolisHastingsSampler(java.lang.Object state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng)
Generate GenericChainStepEvent s at each step |
|
CustomMetropolisHastingsSampler(java.lang.Object state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng,
boolean detailed)
|
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
target
protected UnnormalizedDensity target
proposal
protected GeneralProposal proposal
prng
protected PRNG prng
debug
public boolean debug
current
protected java.lang.Object current
proposed
protected java.lang.Object proposed
logAcceptProb
protected double logAcceptProb
uniformRand
protected double uniformRand
accepted
protected boolean accepted
log_p_X
protected double log_p_X
log_q_X_to_Y
protected double log_q_X_to_Y
log_p_Y
protected double log_p_Y
log_q_Y_to_X
protected double log_q_Y_to_X
numProposed
protected int numProposed
numAccepted
protected int numAccepted
detailed
protected boolean detailed
CustomMetropolisHastingsSampler
protected CustomMetropolisHastingsSampler()
CustomMetropolisHastingsSampler
public CustomMetropolisHastingsSampler(ContainerState state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng,
boolean detailed)
- Default constructor
CustomMetropolisHastingsSampler
public CustomMetropolisHastingsSampler(java.lang.Object state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng,
boolean detailed)
CustomMetropolisHastingsSampler
public CustomMetropolisHastingsSampler(ContainerState state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng)
- Generate
GenericChainStepEvent
s at each step
CustomMetropolisHastingsSampler
public CustomMetropolisHastingsSampler(java.lang.Object state,
UnnormalizedDensity target,
GeneralProposal proposal,
PRNG prng)
- Generate
GenericChainStepEvent
s at each step
getProposal
public GeneralProposal getProposal()
getTarget
public UnnormalizedDensity getTarget()
getPRNG
public PRNG getPRNG()
current
public java.lang.Object current()
proposed
public java.lang.Object proposed()
logAcceptProb
public double logAcceptProb()
uniformRand
public double uniformRand()
accepted
public boolean accepted()
log_p_X
public double log_p_X()
log_q_X_to_Y
public double log_q_X_to_Y()
log_p_Y
public double log_p_Y()
log_q_Y_to_X
public double log_q_Y_to_X()
numProposed
public int numProposed()
numAccepted
public int numAccepted()
acceptanceRatio
public double acceptanceRatio()
resetCounters
public void resetCounters()
detailed
public boolean detailed()
detailed
public boolean detailed(boolean flag)
arrayToString
protected java.lang.String arrayToString(java.lang.Object contents)
generate
public MCMCState generate(MCMCState state)
- Generate the next state from the current one. This method assumes
that
current
is a ContainerState
, and
uses this to pass a "raw" object to the proposal
and
target
.
- Overrides:
generate
in class CustomMarkovChain
acceptanceProb
protected double acceptanceProb(java.lang.Object current,
java.lang.Object proposed)
logAcceptanceProb
protected double logAcceptanceProb(java.lang.Object current,
java.lang.Object proposed)
step
public void step()
- Generate the next state from the current state.
- Overrides:
step
in class BaseMarkovChain
main
public static void main(java.lang.String[] argv)