|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blog.Sampler blog.RejectionSampler
public class RejectionSampler
Generates a partial world by sampling basic random variables in an
order that does not depend on the evidence or queries, but only on
which basic RVs are supported by the instantiation created so far.
If it was initialized with the usual initialize
method, the RejectionSampler stops when all the query and evidence
variables have been instantiated. If it was initialized with
initializeCompleteSampling
, however, it keeps going
until it has instantiated all the basic RVs whose arguments exist
in the generated world.
The RejectionSampler constructor looks for the following properties in the properties table:
Field Summary |
---|
Fields inherited from class blog.Sampler |
---|
evidence, model, queries |
Constructor Summary | |
---|---|
RejectionSampler(Model model,
java.util.Properties properties)
Creates a new RejectionSampler for the given model, with configuration parameters specified by the given properties table. |
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 |
initializeCompleteSampling()
Alternative initialization method that does not specify any evidence or queries, but tells this object to generate complete worlds (possibly up to the bounds specified by the intBound and depthBound properties). |
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 |
Constructor Detail |
---|
public RejectionSampler(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 initializeCompleteSampling()
public void nextSample()
Sampler
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()
Sampler
printStats
in class Sampler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |