gov.sandia.cognition.statistics.bayesian
Class RejectionSampling.DefaultUpdater<ObservationType,ParameterType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.bayesian.RejectionSampling.DefaultUpdater<ObservationType,ParameterType>
Type Parameters:
ObservationType - Type of observation
ParameterType - Type of parameters to infer
All Implemented Interfaces:
RejectionSampling.Updater<ObservationType,ParameterType>, CloneableSerializable, Serializable, Cloneable
Enclosing class:
RejectionSampling<ObservationType,ParameterType>

public static class RejectionSampling.DefaultUpdater<ObservationType,ParameterType>
extends AbstractCloneableSerializable
implements RejectionSampling.Updater<ObservationType,ParameterType>

Default ImportanceSampling Updater that uses a BayesianParameter to compute the quantities of interest.

See Also:
Serialized Form

Field Summary
protected  BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive
          Defines the parameter that connects the conditional and prior distributions.
protected  int proposals
          Number of proposals suggested
protected  Double scale
          Scale factor to multiply the sampler function by to envelop the conjunctive distribution.
 
Constructor Summary
RejectionSampling.DefaultUpdater()
          Default constructor.
RejectionSampling.DefaultUpdater(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive)
          Creates a new instance of DefaultUpdater
RejectionSampling.DefaultUpdater(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive, Double scale, ProbabilityFunction<ParameterType> sampler)
          Creates a new instance of DefaultUpdater
RejectionSampling.DefaultUpdater(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive, ProbabilityFunction<ParameterType> sampler)
          Creates a new instance of DefaultUpdater
 
Method Summary
 double computeAcceptanceProbability(ParameterType parameter, Iterable<? extends ObservationType> data)
          Computes the probability of accepting the parameter for the given data.
 UnivariateGaussian.PDF computeGaussianSampler(Iterable<? extends ObservationType> data, Random random, int numSamples)
          Computes a Gaussian sample for the parameter, assuming it has is a Double, using importance sampling.
 double computeOptimalScale(Iterable<? extends ObservationType> data)
          Computes the optimal scale factor for enveloping the conjunctive distribution with the sampler function given the data
 BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> getConjuctive()
          Getter for conjunctive
 int getProposals()
          Getter for proposals
 ProbabilityFunction<ParameterType> getSampler()
          Getter for sampler
 Double getScale()
          Getter for scale
 ParameterType makeProposal(Random random)
          Samples from the parameter prior
 void setConjuctive(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive)
          Setter for conjunctive
protected  void setProposals(int proposals)
          Setter for proposals
 void setSampler(ProbabilityFunction<ParameterType> sampler)
          Setter for sampler
 void setScale(Double scale)
          Setter for scale
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.CloneableSerializable
clone
 

Field Detail

conjuctive

protected BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive
Defines the parameter that connects the conditional and prior distributions.


scale

protected Double scale
Scale factor to multiply the sampler function by to envelop the conjunctive distribution.


proposals

protected int proposals
Number of proposals suggested

Constructor Detail

RejectionSampling.DefaultUpdater

public RejectionSampling.DefaultUpdater()
Default constructor.


RejectionSampling.DefaultUpdater

public RejectionSampling.DefaultUpdater(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive)
Creates a new instance of DefaultUpdater

Parameters:
conjuctive - Defines the parameter that connects the conditional and prior distributions.

RejectionSampling.DefaultUpdater

public RejectionSampling.DefaultUpdater(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive,
                                        ProbabilityFunction<ParameterType> sampler)
Creates a new instance of DefaultUpdater

Parameters:
conjuctive - Defines the parameter that connects the conditional and prior distributions.
sampler - Distribution from which we sample and envelop the conjunctive distribution.

RejectionSampling.DefaultUpdater

public RejectionSampling.DefaultUpdater(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive,
                                        Double scale,
                                        ProbabilityFunction<ParameterType> sampler)
Creates a new instance of DefaultUpdater

Parameters:
conjuctive - Defines the parameter that connects the conditional and prior distributions.
scale - Scale factor to multiply the sampler function by to envelop the conjunctive distribution.
sampler - Distribution from which we sample and envelop the conjunctive distribution.
Method Detail

computeAcceptanceProbability

public double computeAcceptanceProbability(ParameterType parameter,
                                           Iterable<? extends ObservationType> data)
Description copied from interface: RejectionSampling.Updater
Computes the probability of accepting the parameter for the given data.

Specified by:
computeAcceptanceProbability in interface RejectionSampling.Updater<ObservationType,ParameterType>
Parameters:
parameter - Parameter to consider
data - Data to consider.
Returns:
Probability of accepting the parameter

makeProposal

public ParameterType makeProposal(Random random)
Description copied from interface: RejectionSampling.Updater
Samples from the parameter prior

Specified by:
makeProposal in interface RejectionSampling.Updater<ObservationType,ParameterType>
Parameters:
random - Random number generator.
Returns:
Location of the proposed sample

getConjuctive

public BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> getConjuctive()
Getter for conjunctive

Returns:
Defines the parameter that connects the conditional and prior distributions.

setConjuctive

public void setConjuctive(BayesianParameter<ParameterType,? extends ProbabilityFunction<ObservationType>,? extends ProbabilityFunction<ParameterType>> conjuctive)
Setter for conjunctive

Parameters:
conjuctive - Defines the parameter that connects the conditional and prior distributions.

computeOptimalScale

public double computeOptimalScale(Iterable<? extends ObservationType> data)
Computes the optimal scale factor for enveloping the conjunctive distribution with the sampler function given the data

Parameters:
data - Data to consider
Returns:
optimal scale factor for enveloping the conjunctive distribution with the sampler function given the data

computeGaussianSampler

public UnivariateGaussian.PDF computeGaussianSampler(Iterable<? extends ObservationType> data,
                                                     Random random,
                                                     int numSamples)
Computes a Gaussian sample for the parameter, assuming it has is a Double, using importance sampling.

Parameters:
data - (Sub)set of the data to use to estimate the Gaussian
random - Random number generator
numSamples - Number of samples to create the Gaussian... doesn't need to be very large.
Returns:
Gaussian that has the appropriate mean and variance to generate parameters.

getScale

public Double getScale()
Getter for scale

Returns:
Scale factor to multiply the sampler function by to envelop the conjunctive distribution.

setScale

public void setScale(Double scale)
Setter for scale

Parameters:
scale - Scale factor to multiply the sampler function by to envelop the conjunctive distribution.

getProposals

public int getProposals()
Getter for proposals

Returns:
Number of proposals suggested

setProposals

protected void setProposals(int proposals)
Setter for proposals

Parameters:
proposals - Number of proposals suggested

getSampler

public ProbabilityFunction<ParameterType> getSampler()
Getter for sampler

Returns:
Distribution from which we sample and envelop the conjunctive distribution.

setSampler

public void setSampler(ProbabilityFunction<ParameterType> sampler)
Setter for sampler

Parameters:
sampler - Distribution from which we sample and envelop the conjunctive distribution.