Class RejectionSampling<ObservationType,ParameterType>

  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.util.AbstractRandomized
          extended by gov.sandia.cognition.statistics.bayesian.RejectionSampling<ObservationType,ParameterType>
Type Parameters:
ObservationType - Type of observation
ParameterType - Type of parameters to infer
All Implemented Interfaces:
BatchLearner<Collection<? extends ObservationType>,DataDistribution<ParameterType>>, BayesianEstimator<ObservationType,ParameterType,DataDistribution<ParameterType>>, CloneableSerializable, Randomized, Serializable, Cloneable

                      title="Rejection Sampling",
public class RejectionSampling<ObservationType,ParameterType>
extends AbstractRandomized
implements BayesianEstimator<ObservationType,ParameterType,DataDistribution<ParameterType>>

Rejection sampling is a method of inferring hidden parameters by using an easy-to-sample-from distribution (times a scale factor) that envelopes another distribution that is difficult to sample from. Typically, we sample from the parameter prior to infer the likelihood of the parameters given an observation sequence. In my limited experience, vanilla rejection sampling, implemented here, is inferior to ImportanceSamping.

Kevin R. Dixon
See Also:
Serialized Form

Nested Class Summary
static class RejectionSampling.DefaultUpdater<ObservationType,ParameterType>
          Default ImportanceSampling Updater that uses a BayesianParameter to compute the quantities of interest.
static class RejectionSampling.ScalarEstimator<ObservationType>
          Routine for estimating the minimum scalar needed to envelop the conjunctive distribution.
static interface RejectionSampling.Updater<ObservationType,ParameterType>
          Updater for ImportanceSampling
Field Summary
          Default number of samples, 1000.
protected  RejectionSampling.Updater<ObservationType,ParameterType> updater
          Updater for the ImportanceSampling algorithm.
Fields inherited from class gov.sandia.cognition.util.AbstractRandomized
Constructor Summary
          Creates a new instance of RejectionSampling
Method Summary
 RejectionSampling<ObservationType,ParameterType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 int getNumSamples()
          Getter for numSamples
 RejectionSampling.Updater<ObservationType,ParameterType> getUpdater()
          Getter for updater
 DataDistribution<ParameterType> learn(Collection<? extends ObservationType> data)
          The learn method creates an object of ResultType using data of type DataType, using some form of "learning" algorithm.
 void setNumSamples(int numSamples)
          Setter for numSamples
 void setUpdater(RejectionSampling.Updater<ObservationType,ParameterType> updater)
          Setter for updater
Methods inherited from class gov.sandia.cognition.util.AbstractRandomized
getRandom, setRandom
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


public static final int DEFAULT_NUM_SAMPLES
Default number of samples, 1000.

See Also:
Constant Field Values


protected RejectionSampling.Updater<ObservationType,ParameterType> updater
Updater for the ImportanceSampling algorithm.

Constructor Detail


public RejectionSampling()
Creates a new instance of RejectionSampling

Method Detail


public RejectionSampling<ObservationType,ParameterType> clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
clone in class AbstractRandomized
A clone of this object.


public DataDistribution<ParameterType> learn(Collection<? extends ObservationType> data)
Description copied from interface: BatchLearner
The learn method creates an object of ResultType using data of type DataType, using some form of "learning" algorithm.

Specified by:
learn in interface BatchLearner<Collection<? extends ObservationType>,DataDistribution<ParameterType>>
data - The data that the learning algorithm will use to create an object of ResultType.
The object that is created based on the given data using the learning algorithm.


public int getNumSamples()
Getter for numSamples

Number of samples.


public void setNumSamples(int numSamples)
Setter for numSamples

numSamples - Number of samples.


public RejectionSampling.Updater<ObservationType,ParameterType> getUpdater()
Getter for updater

Updater for the ImportanceSampling algorithm.


public void setUpdater(RejectionSampling.Updater<ObservationType,ParameterType> updater)
Setter for updater

updater - Updater for the ImportanceSampling algorithm.