Class ImportanceSampling<ObservationType,ParameterType>

  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.util.AbstractRandomized
          extended by gov.sandia.cognition.statistics.bayesian.ImportanceSampling<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="Importance Sampling",
public class ImportanceSampling<ObservationType,ParameterType>
extends AbstractRandomized
implements BayesianEstimator<ObservationType,ParameterType,DataDistribution<ParameterType>>

Importance sampling is a Monte Carlo inference technique where we sample from an easy distribution over the hidden variables (parameters) and then weight the result by the ratio of the likelihood of the parameters given the evidence and the likelihood of generating the parameters. This is a simple alternative to MCMC that is computationally simple, but does not scale well to many data points or many dimensions.

Kevin R. Dixon
See Also:
Serialized Form

Nested Class Summary
static class ImportanceSampling.DefaultUpdater<ObservationType,ParameterType>
          Default ImportanceSampling Updater that uses a BayesianParameter to compute the quantities of interest.
static interface ImportanceSampling.Updater<ObservationType,ParameterType>
          Updater for ImportanceSampling
Field Summary
          Default maximum number of samples, 1000.
protected  ImportanceSampling.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 ImportanceSampling
Method Summary
 ImportanceSampling<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
 ImportanceSampling.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(ImportanceSampling.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 maximum number of samples, 1000.

See Also:
Constant Field Values


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

Constructor Detail


public ImportanceSampling()
Creates a new instance of ImportanceSampling

Method Detail


public ImportanceSampling<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 ImportanceSampling.Updater<ObservationType,ParameterType> getUpdater()
Getter for updater

Updater for the ImportanceSampling algorithm.


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

updater - Updater for the ImportanceSampling algorithm.


public int getNumSamples()
Getter for numSamples

Number of samples.


public void setNumSamples(int numSamples)
Setter for numSamples

numSamples - Number of samples.