|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Sampler blog.MHSampler
public class MHSampler
Generates samples from a Markov chain over possible worlds using a Metropolis-Hastings algorithm. The proposal distribution for this algorithm is represented by an object that implements the Proposer interface.
The MHSampler constructor looks at the following properties in the properties table that is passed in:
Field Summary | |
---|---|
protected Timer |
acceptProbTimer
|
protected PartialWorldDiff |
curWorld
|
protected int |
numAcceptedThisTrial
|
protected int |
numSamplesThisTrial
|
protected int |
numTrials
|
protected Proposer |
proposer
|
protected int |
totalNumAccepted
|
protected int |
totalNumSamples
|
protected Timer |
worldUpdateTimer
|
Fields inherited from class blog.Sampler |
---|
evidence, model, queries |
Constructor Summary | |
---|---|
MHSampler(Model model,
java.util.Properties properties)
Creates a new sampler for the given BLOG model. |
Method Summary | |
---|---|
protected void |
constructProposer(java.util.Properties properties)
Method responsible for initializing the proposer field. |
PartialWorld |
getLatestWorld()
Returns the world generated by the most recent call to nextSample . |
void |
initialize(Evidence evidence,
java.util.List queries)
Prepares this sampler to sample from the distribution conditioned on the given evidence, returning PartialWorld objects that are complete enough to answer the given queries. |
void |
nextSample()
Generates the next world in the Markov chain. |
PartialWorld |
nextSample(PartialWorld world)
Samples from some given world, leaving the current world in sampler undisturbed. |
void |
printStats()
Print statistics gathered during sampling to standard out. |
void |
setWorld(PartialWorld w)
|
Methods inherited from class blog.Sampler |
---|
getLatestWeight |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Timer acceptProbTimer
protected Timer worldUpdateTimer
protected Proposer proposer
protected PartialWorldDiff curWorld
protected int numTrials
protected int totalNumSamples
protected int totalNumAccepted
protected int numSamplesThisTrial
protected int numAcceptedThisTrial
Constructor Detail |
---|
public MHSampler(Model model, java.util.Properties properties)
Method Detail |
---|
protected void constructProposer(java.util.Properties properties)
public void initialize(Evidence evidence, java.util.List queries)
Sampler
The default implementation just sets the
evidence
and queries
member variables.
initialize
in class Sampler
queries
- List of Query objectspublic void setWorld(PartialWorld w)
public void nextSample()
nextSample
in class Sampler
public PartialWorld nextSample(PartialWorld world)
public PartialWorld getLatestWorld()
Sampler
nextSample
. The returned PartialWorld object may
be modified by the next call to nextSample
.
getLatestWorld
in class Sampler
public void printStats()
printStats
in class Sampler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |