|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Sampler
public abstract class Sampler
An object that stochastically generates a sequence of samples, which are possible worlds of a given BLOG model. A Sampler object may generate independent samples, or it may maintain internal state (e.g., a Markov chain sampler). The samples generated may also have associated weights, as in likelihood weighting.
A concrete Sampler subclass should have a constructor that takes two arguments: a blog.Model object and a java.util.Properties object. The properties object specifies configuration parameters for the sampler.
Field Summary | |
---|---|
protected Evidence |
evidence
Evidence specified by the last call to initialize ,
or null if initialize has not been called. |
protected Model |
model
BLOG model for which this sampler generates partial worlds. |
protected java.util.List |
queries
List of Query objects specified by the last call to initialize , or null if initialize has
not been called. |
Constructor Summary | |
---|---|
Sampler(Model model)
Creates a Sampler object for the given BLOG model. |
Method Summary | |
---|---|
double |
getLatestWeight()
Returns the weight for the world generated by the most recent call to nextSample . |
abstract 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. |
abstract void |
nextSample()
Generates the next sample (world), and possibly assigns it a weight. |
void |
printStats()
Prints statistics about the internal activities of this sampler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Model model
protected Evidence evidence
initialize
,
or null if initialize
has not been called.
protected java.util.List queries
initialize
, or null if initialize
has
not been called.
Constructor Detail |
---|
public Sampler(Model model)
Method Detail |
---|
public void initialize(Evidence evidence, java.util.List queries)
The default implementation just sets the
evidence
and queries
member variables.
queries
- List of Query objectspublic abstract void nextSample()
java.lang.IllegalStateException
- if initialize
has not
been called on this Samplerpublic abstract PartialWorld getLatestWorld()
nextSample
. The returned PartialWorld object may
be modified by the next call to nextSample
.
java.lang.IllegalStateException
- if nextSample
has not been
called, or if initialize
has been called since the last call
to nextSample
public double getLatestWeight()
nextSample
. The default implementation returns 1.0.
java.lang.IllegalStateException
- if nextSample
has not been
called, or if initialize
has been called since the last call
to nextSample
public void printStats()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |