|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.GenericProposer
public class GenericProposer
Implements a generic MCMC proposal algorithm. Each step changes the value of exactly one instantiated RV (selected uniformly at random from the instantiated RVs), then samples values for previously uninstantiated RVs to make the resulting instantiation self-supporting. It also uninstantiates any RVs that become barren.
Each variable is sampled from its prior distribution given its parents. The forward proposal probability is just the probability of choosing the selected variable to change, times the product of the probabilities of values sampled (for that variable and any other variables that must be instantiated to make the instantiation self-supporting). The backward probability is the probability of choosing the same variable again, choosing its old value, and re-instantiating all the newly uninstantiated variables to their old values. No other moves can yield the same proposed world because each move changes the value of exactly one instantiated variable (it just instantiates and uninstantiates other variables).
GenericProposer does not use identifiers in the worlds it constructs.
Nested Class Summary | |
---|---|
protected class |
GenericProposer.PickVarToSampleResult
|
Field Summary | |
---|---|
protected Evidence |
evidence
|
protected java.util.Set |
evidenceVars
|
protected Sampler |
initialStateSampler
|
protected double |
logProbBackward
|
protected double |
logProbForward
|
protected Model |
model
|
protected int |
numBasicEvidenceVars
|
protected int |
numInitialStateTriesThisTrial
|
protected int |
numTrials
|
protected java.util.List |
queries
|
protected java.util.Set |
queryVars
|
protected int |
totalNumInitialStateTries
|
Constructor Summary | |
---|---|
GenericProposer(Model model,
java.util.Properties properties)
Creates a new GenericProposer that proposes possible worlds for the given model. |
Method Summary | |
---|---|
void |
add(Evidence evidence)
Adds extra evidence to the evidence the proposer must consider. |
void |
addQueries(java.util.List queries)
Adds extra queries to the ones the proposer must consider. |
protected PartialWorldDiff |
constructInitialState()
Actually builds initial state, after whatever initializations are necessary. |
PartialWorldDiff |
initialize(Evidence evidence,
java.util.List queries)
Set up the initial state. |
protected GenericProposer.PickVarToSampleResult |
pickVarToSample(PartialWorld world)
|
void |
printStats()
Prints any relevant statistics about the internal behavior of this proposer. |
double |
proposeNextState(PartialWorldDiff world)
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 |
Field Detail |
---|
protected Model model
protected Sampler initialStateSampler
protected Evidence evidence
protected java.util.List queries
protected java.util.Set evidenceVars
protected int numBasicEvidenceVars
protected java.util.Set queryVars
protected double logProbForward
protected double logProbBackward
protected int numTrials
protected int totalNumInitialStateTries
protected int numInitialStateTriesThisTrial
Constructor Detail |
---|
public GenericProposer(Model model, java.util.Properties properties)
Method Detail |
---|
public PartialWorldDiff initialize(Evidence evidence, java.util.List queries)
initialize
in interface Proposer
queries
- List of Query objectspublic void add(Evidence evidence)
public void addQueries(java.util.List queries)
protected PartialWorldDiff constructInitialState()
initialize(Evidence,List)
so extensions can change it alone.
protected GenericProposer.PickVarToSampleResult pickVarToSample(PartialWorld world)
public double proposeNextState(PartialWorldDiff world)
proposeNextState
in interface Proposer
public void printStats()
Proposer
printStats
in interface Proposer
public void updateStats(boolean accepted)
Proposer
accepted
is true) or rejected
(if accepted
is false).
updateStats
in interface Proposer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |