de.jstacs.models.mixture.gibbssampling
Interface GibbsSamplingModel

All Superinterfaces:
GibbsSamplingComponent
All Known Implementing Classes:
FSDAGModelForGibbsSampling

public interface GibbsSamplingModel
extends GibbsSamplingComponent

This is the interface that any AbstractModel has to implement if it should be used in a Gibbs Sampling.

Before starting a series of samplings the method GibbsSamplingComponent.initModelForSampling(int) is called.
Then before starting a specific sampling the method GibbsSamplingComponent.extendSampling(int, boolean) is called.
In the sampling the method drawParameters(Sample, double[] ) is used for drawing the parameters from the posterior (and writing them to a file).
After finishing the sampling the method GibbsSamplingComponent.samplingStopped() is called.
After a sampling the methods GibbsSamplingComponent.parseParameterSet(int, int) and GibbsSamplingComponent.parseNextParameterSet() will be used for computing for instance the (log-) likelihoods.


The method GibbsSamplingComponent.isInSamplingMode() can be used to check whether an object is currently used for sampling. If the object is in sampling mode, it should not support any other method for changing the parameters than drawParameters(Sample, double[] ) and GibbsSamplingComponent.parseParameterSet(int, int). Furthermore it is legal to throw an Exception when the object is in sampling mode and a method for saving, cloning or training the parameters is called.

Author:
Berit Haldemann, Jens Keilwagen
See Also:
AbstractModel, AbstractMixtureModel, AbstractMixtureModel.Algorithm.GIBBS_SAMPLING

Method Summary
 void drawParameters(Sample data, double[] weights)
          This method draws the parameters of the model from the a posteriori density.
 
Methods inherited from interface de.jstacs.models.mixture.gibbssampling.GibbsSamplingComponent
extendSampling, initModelForSampling, isInSamplingMode, parseNextParameterSet, parseParameterSet, samplingStopped
 

Method Detail

drawParameters

void drawParameters(Sample data,
                    double[] weights)
                    throws Exception
This method draws the parameters of the model from the a posteriori density. It is recommended that the parameters are written to a specific file so that they can later be parsed using the methods of the interface.

Before using this method the method GibbsSamplingComponent.initModelForSampling(int) should be called.

Parameters:
data - a sample
weights - the (non-negative) weights for each sequence of the sample
Throws:
Exception - if there is a problem with drawing the parameters, the model is not initialized, ...
See Also:
GibbsSamplingComponent.initModelForSampling(int), GibbsSamplingComponent.parseParameterSet(int, int), GibbsSamplingComponent.parseNextParameterSet()