|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Query
Interface for queries that can be answered by an inference engine. A Query object records both results from a single run of an inference algorithm, and statistics about the results of several runs (if the inference algorithm is randomized, each run may yield different results).
The getVariables
method returns a set of random
variables such that the result of this query depends only on the
posterior joint distribution of these variables. There are two
ways in which this posterior distribution can be provided to the
Query object. One is to call updateStats
repeatedly,
passing in partial worlds with weights; these worlds must be
complete enough to define values for all the query's variables. The
other way is to pass in a factor over these variables using
setPosterior
.
Method Summary | |
---|---|
boolean |
checkTypesAndScope(Model model)
Returns true if this query satisfies type and scope constraints. |
int |
compile()
Does compilation steps that can only be done correctly once the model is complete. |
java.lang.Object |
getLocation()
Returns an object whose toString method yields a description of the location where this query occurred in an input file. |
java.util.Collection<? extends BayesNetVar> |
getVariables()
Returns a collection of (basic or derived) random variables such that the result of this query depends only on the posterior joint distribution for these variables. |
void |
logResults(int numSamples)
If a log file has been specified, prints the results so far to that file. |
void |
printResults(java.io.PrintStream s)
Prints the results of this query to the given stream. |
void |
printVarianceResults(java.io.PrintStream s)
Prints across-run statistics. |
void |
setPosterior(ve.Factor posterior)
Sets the posterior distribution for the variables returned by getVariables . |
void |
updateStats(PartialWorld world,
double weight)
Updates the within-run statistics for this query to reflect the given world sampled with the given weight. |
void |
zeroOut()
Ends the current run, records across-run statistics for it, and clears the within-run statistics. |
Method Detail |
---|
void printResults(java.io.PrintStream s)
void logResults(int numSamples)
numSamples
- the number of samples taken by the inference
engine so far (can be set to zero for
non-sampling inference engines)java.util.Collection<? extends BayesNetVar> getVariables()
java.lang.IllegalStateException
- if compile
has not
yet been calledboolean checkTypesAndScope(Model model)
int compile()
void updateStats(PartialWorld world, double weight)
getVariables
.
The effects of calling both updateStats
and
setPosterior
in the same run are not defined.
void setPosterior(ve.Factor posterior)
getVariables
. This overwrites any results
specified previously for the current run using this method or
updateStats
.
The effects of calling both updateStats
and
setPosterior
in the same run are not defined.
posterior
- factor whose set of variables is the same
as the collection returned by getVariables,
and whose entries sum to 1void zeroOut()
void printVarianceResults(java.io.PrintStream s)
java.lang.Object getLocation()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |