|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Sampler blog.LWSampler
public class LWSampler
A likelihood weighting sampler. Instantiates the context-specifically active ancestors of the query and evidence variables. Rather than sampling the evidence variables, it just instantiates them to their observed values. The weight of a sample is the product of the probabilities of the evidence variables given their parents.
The LWSampler constructor looks at the following properties in the properties table that is passed in:
Field Summary |
---|
Fields inherited from class blog.Sampler |
---|
evidence, model, queries |
Constructor Summary | |
---|---|
LWSampler(Model model,
java.util.Properties properties)
Creates a new sampler that for the given BLOG model. |
Method Summary | |
---|---|
double |
getLatestWeight()
Returns the weight for the world generated by the most recent call to nextSample . |
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 partial world and computes its weight. |
void |
printStats()
Print statistics gathered during sampling to standard out. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LWSampler(Model model, java.util.Properties properties)
Method Detail |
---|
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 nextSample()
nextSample
in class Sampler
public PartialWorld getLatestWorld()
Sampler
nextSample
. The returned PartialWorld object may
be modified by the next call to nextSample
.
getLatestWorld
in class Sampler
public double getLatestWeight()
Sampler
nextSample
. The default implementation returns 1.0.
getLatestWeight
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 |