gov.sandia.cognition.statistics.bayesian
Class DirichletProcessMixtureModel.Sample<ObservationType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.statistics.bayesian.DirichletProcessMixtureModel.Sample<ObservationType>
Type Parameters:
ObservationType - Type of observations handled by the mixture model
All Implemented Interfaces:
CloneableSerializable, Serializable, Cloneable
Enclosing class:
DirichletProcessMixtureModel<ObservationType>

public static class DirichletProcessMixtureModel.Sample<ObservationType>
extends AbstractCloneableSerializable

A sample from the Dirichlet Process Mixture Model.

See Also:
Serialized Form

Field Summary
protected  double alpha
          Scaling parameter which defines the strength of the base distribution, must be greater than zero.
protected  ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters
          Point mass realizations from the base distribution.
 
Constructor Summary
DirichletProcessMixtureModel.Sample(double alpha, ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
          Creates a new instance of Sample
 
Method Summary
 DirichletProcessMixtureModel.Sample<ObservationType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 double computePosteriorLogLikelihood(int numObservations, double logConditional)
          Computes the posterior log likelihood of the Sample
 double computePosteriorLogLikelihood(Iterable<? extends ObservationType> data)
          Computes the posterior log likelihood of the data given the clusters and the prior probability of the clustering from a Chinese Restaurant Process
 double getAlpha()
          Getter for alpha
 ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> getClusters()
          Getter for clusters
 int getNumClusters()
          Gets the number of clusters in the Sample
 Double getPosteriorLogLikelihood()
          Gets the posterior log-likelihood.
 void removeUnusedClusters()
          Removes the unused clusters from the Sample.
protected  void setAlpha(double alpha)
          Setter for alpha
protected  void setClusters(ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
          Setter for clusters
 void setPosteriorLogLikelihood(Double posteriorLogLikelihood)
          sets the posterior log-likelihood.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alpha

protected double alpha
Scaling parameter which defines the strength of the base distribution, must be greater than zero.


clusters

protected ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters
Point mass realizations from the base distribution.

Constructor Detail

DirichletProcessMixtureModel.Sample

public DirichletProcessMixtureModel.Sample(double alpha,
                                           ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
Creates a new instance of Sample

Parameters:
alpha - Scaling parameter which defines the strength of the base distribution, must be greater than zero.
clusters - Point mass realizations from the base distribution.
Method Detail

clone

public DirichletProcessMixtureModel.Sample<ObservationType> 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
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

computePosteriorLogLikelihood

public double computePosteriorLogLikelihood(Iterable<? extends ObservationType> data)
Computes the posterior log likelihood of the data given the clusters and the prior probability of the clustering from a Chinese Restaurant Process

Parameters:
data - Data to consider
Returns:
Posterior log likelihood of the data

computePosteriorLogLikelihood

public double computePosteriorLogLikelihood(int numObservations,
                                            double logConditional)
Computes the posterior log likelihood of the Sample

Parameters:
numObservations - Number of observations in the Sample
logConditional - Log conditional likelihood of the data given the sample
Returns:
Posterior log likelihood

removeUnusedClusters

public void removeUnusedClusters()
Removes the unused clusters from the Sample.


getAlpha

public double getAlpha()
Getter for alpha

Returns:
Scaling parameter which defines the strength of the base distribution, must be greater than zero.

setAlpha

protected void setAlpha(double alpha)
Setter for alpha

Parameters:
alpha - Scaling parameter which defines the strength of the base distribution, must be greater than zero.

getNumClusters

public int getNumClusters()
Gets the number of clusters in the Sample

Returns:
Number of clusters in the Sample.

getClusters

public ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> getClusters()
Getter for clusters

Returns:
Point mass realizations from the base distribution.

setClusters

protected void setClusters(ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
Setter for clusters

Parameters:
clusters - Point mass realizations from the base distribution.

getPosteriorLogLikelihood

public Double getPosteriorLogLikelihood()
Gets the posterior log-likelihood.

Returns:
The posterior log-likelihood.

setPosteriorLogLikelihood

public void setPosteriorLogLikelihood(Double posteriorLogLikelihood)
sets the posterior log-likelihood.

Parameters:
posteriorLogLikelihood - The posterior log-likelihood.