com.cra.figaro.experimental.marginalmap
Special probability of evidence sampler used for marginal MAP.
Special probability of evidence sampler used for marginal MAP. Unlike a regular probability of evidence sampler, this records its own variance. It does so in an online fashion, and computes it in log space to prevent underflow. Additionally, this algorithm may be run multiple times. The rolling mean and variance computation incorporates the samples taken from all runs.
A sample is a map from elements to their values.
A sample is a map from elements to their values.
Get the acceptance ratio for the sampler.
Get the acceptance ratio for the sampler.
Clean up the sampler, freeing memory.
Clean up the sampler, freeing memory.
Decides whether or not the mean of the old sampler, multiplied by the constant given, is likely to be less than the mean of the new sampler.
Decides whether or not the mean of the old sampler, multiplied by the constant given, is likely to be less than the mean of the new sampler. Computes in log space to avoid underflow. This may mutate the state of the universe. This does not take into account conditions and constraints on the MAP elements directly; these should be incorporated in the log constant provided.
Probability of evidence sampler for the previous state of the MAP elements.
Probability of evidence sampler for the next state of the MAP elements.
Log of a multiplicative constant, by which we multiply the mean of the old sampler.
Maximum allowed additional runs of probability of evidence sampling before this method should return a best guess. This is a kill switch to avoid taking an absurd number of samples when the difference between the means is negligible. Must be >= 0. Setting this to 0 is equivalent to performing no hypothesis test at all and just comparing the values.
A decision to accept based on a one-sided t-test of the weights sampled from the two samplers.
Record the current values of all MAP elements.
Record the current values of all MAP elements.
Set this flag to true to obtain debugging information.
Set this flag to true to obtain debugging information.
Decide whether or not to accept the new (unconstrained) state, first taking into account conditions on the MAP elements.
Decide whether or not to accept the new (unconstrained) state, first taking into account conditions on the MAP elements. Does not change the state of the universe. Updates the temperature, preserved elements, and probability of evidence sampler accordingly. Incorporates constraints on the MAP elements.
Like decideToAccept, but assume all conditions on the MAP elements are satisfied.
Like decideToAccept, but assume all conditions on the MAP elements are satisfied.
Number of samples taken
Number of samples taken
Get the current temperature.
Get the current temperature. Used for debugging.
Called when the algorithm is started before running any steps.
Called when the algorithm is started before running any steps. By default, does nothing. Can be overridden.
Kill the algorithm so that it is inactive.
Kill the algorithm so that it is inactive. It will no longer be able to provide answers.Throws AlgorithmInactiveException if the algorithm is not active.
List of elements over which to perform marginal MAP.
List of elements over which to perform marginal MAP. These elements must not have evidence on them that is contingent on the values of non-MAP elements. Additionally, these elements must be "observable", in the sense that observing values for these elements and computing the probability of evidence of those observations should not uniquely return zero. Typically, this is satisfiable by elements that are not both continuous and deterministic. The algorithm will still run if this condition is not satisfied, but it will not converge.
Returns an estimate of the max a posteriori value of the target.
Returns an estimate of the max a posteriori value of the target.
AlgorithmInactiveException
if the algorithm is inactive.
NotATargetException
if called on a target that is not in the list of MAP elements.
The number of samples to collect from the model.
The number of samples to collect from the model.
Resume the computation of the algorithm, if it has been stopped.
Resume the computation of the algorithm, if it has been stopped. Throws AlgorithmInactiveException if the algorithm is not active.
Run the algorithm, performing its computation to completion.
Run the algorithm, performing its computation to completion.
Produce a single sample.
Produce a single sample.
Start the algorithm and make it active.
Start the algorithm and make it active. After it returns, the algorithm must be ready to provide answers. Throws AlgorithmActiveException if the algorithm is already active.
Stop the algorithm from computing.
Stop the algorithm from computing. The algorithm is still ready to provide answers after it returns. Throws AlgorithmInactiveException if the algorithm is not active.
Test Metropolis-Hastings by repeatedly running a single step from the same initial state.
Test Metropolis-Hastings by repeatedly running a single step from the same initial state. For each of a set of predicates, the fraction of times the predicate is satisfied by the resulting state is returned. By the resulting state, we mean the new state if it is accepted and the original state if not.