ObservationType
- Type of observations handled by the mixture modelpublic static class DirichletProcessMixtureModel.Sample<ObservationType> extends AbstractCloneableSerializable
Modifier and Type | Field and Description |
---|---|
protected double |
alpha
Scaling parameter which defines the strength of the base distribution,
must be greater than zero.
|
protected java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> |
clusters
Point mass realizations from the base distribution.
|
Constructor and Description |
---|
Sample(double alpha,
java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
Creates a new instance of Sample
|
Modifier and Type | Method and Description |
---|---|
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(java.lang.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
|
java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> |
getClusters()
Getter for clusters
|
int |
getNumClusters()
Gets the number of clusters in the Sample
|
java.lang.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(java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
Setter for clusters
|
void |
setPosteriorLogLikelihood(java.lang.Double posteriorLogLikelihood)
sets the posterior log-likelihood.
|
protected double alpha
protected java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters
public Sample(double alpha, java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
alpha
- Scaling parameter which defines the strength of the base distribution,
must be greater than zero.clusters
- Point mass realizations from the base distribution.public DirichletProcessMixtureModel.Sample<ObservationType> clone()
AbstractCloneableSerializable
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.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public double computePosteriorLogLikelihood(java.lang.Iterable<? extends ObservationType> data)
data
- Data to considerpublic double computePosteriorLogLikelihood(int numObservations, double logConditional)
numObservations
- Number of observations in the SamplelogConditional
- Log conditional likelihood of the data given the samplepublic void removeUnusedClusters()
public double getAlpha()
protected void setAlpha(double alpha)
alpha
- Scaling parameter which defines the strength of the base distribution,
must be greater than zero.public int getNumClusters()
public java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> getClusters()
protected void setClusters(java.util.ArrayList<DirichletProcessMixtureModel.DPMMCluster<ObservationType>> clusters)
clusters
- Point mass realizations from the base distribution.public java.lang.Double getPosteriorLogLikelihood()
public void setPosteriorLogLikelihood(java.lang.Double posteriorLogLikelihood)
posteriorLogLikelihood
- The posterior log-likelihood.