be.ac.ulg.montefiore.run.jahmm
Class OpdfGaussianMixture

java.lang.Object
  extended by be.ac.ulg.montefiore.run.jahmm.OpdfGaussianMixture
All Implemented Interfaces:
Opdf<ObservationReal>, java.io.Serializable, java.lang.Cloneable

public class OpdfGaussianMixture
extends java.lang.Object
implements Opdf<ObservationReal>

This class implements a mixture of monovariate gaussian distributions.

Author:
Benjamin Chung (Creation), Jean-Marc Francois (Adaptations / small fix)
See Also:
Serialized Form

Constructor Summary
OpdfGaussianMixture(double[] means, double[] variances, double[] proportions)
          Creates a Gaussian mixture distribution.
OpdfGaussianMixture(int nbGaussians)
          Creates a Gaussian mixture distribution.
 
Method Summary
 OpdfGaussianMixture clone()
           
 void fit(java.util.Collection<? extends ObservationReal> co)
          Fits this observation distribution function to a (non empty) set of observations.
 void fit(java.util.Collection<? extends ObservationReal> co, double[] weights)
          Fits this observation distribution function to a (non empty) weighted set of observations.
 void fit(ObservationReal... oa)
          Fits this observation distribution function to a (non empty) set of observations.
 void fit(ObservationReal[] o, double[] weights)
          Fits this observation distribution function to a (non empty) weighted set of observations.
 ObservationReal generate()
          Generates a (pseudo) random observation according to this distribution.
 double[] means()
          Returns the mean value of each distribution composing this mixture.
 int nbGaussians()
          Returns the number of distributions composing this mixture.
 double probability(ObservationReal o)
          Returns the probability (density) of an observation given a distribution.
 double[] proportions()
          Returns the mixing proportions of each gaussian distribution.
 java.lang.String toString()
           
 java.lang.String toString(java.text.NumberFormat numberFormat)
          Returns a String describing this distribution.
 double[] variances()
          Returns the mean value of each distribution composing this mixture.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OpdfGaussianMixture

public OpdfGaussianMixture(int nbGaussians)
Creates a Gaussian mixture distribution. The mean values of the distributions are evently distributed between 0 and 1 and each variance is equal to 1.

Parameters:
nbGaussians - The number of gaussians that compose this mixture.

OpdfGaussianMixture

public OpdfGaussianMixture(double[] means,
                           double[] variances,
                           double[] proportions)
Creates a Gaussian mixture distribution. The mean and variance of each distribution composing the mixture are given as arguments.

Parameters:
means - The mean values of the Gaussian distributions.
variances - The variances of the Gaussian distributions.
proportions - The mixing proportions. This array does not have to be normalized, but each element must be positive and the sum of its elements must be strictly positive.
Method Detail

probability

public double probability(ObservationReal o)
Description copied from interface: Opdf
Returns the probability (density) of an observation given a distribution.

Specified by:
probability in interface Opdf<ObservationReal>
Parameters:
o - An observation.
Returns:
The probability (density, if o takes continuous values) of o for this function.

generate

public ObservationReal generate()
Description copied from interface: Opdf
Generates a (pseudo) random observation according to this distribution.

Specified by:
generate in interface Opdf<ObservationReal>
Returns:
An observation.

nbGaussians

public int nbGaussians()
Returns the number of distributions composing this mixture.

Returns:
The number of distributions composing this mixture.

proportions

public double[] proportions()
Returns the mixing proportions of each gaussian distribution.

Returns:
A (copy of) array giving the distributions' proportion.

means

public double[] means()
Returns the mean value of each distribution composing this mixture.

Returns:
A copy of the means array.

variances

public double[] variances()
Returns the mean value of each distribution composing this mixture.

Returns:
A copy of the means array.

fit

public void fit(ObservationReal... oa)
Fits this observation distribution function to a (non empty) set of observations. This method performs one iteration of an expectation-maximisation algorithm.

Specified by:
fit in interface Opdf<ObservationReal>
Parameters:
oa - A set of observations compatible with this function.

fit

public void fit(java.util.Collection<? extends ObservationReal> co)
Fits this observation distribution function to a (non empty) set of observations. This method performs one iteration of an expectation-maximisation algorithm.

Specified by:
fit in interface Opdf<ObservationReal>
Parameters:
co - A set of observations compatible with this function.

fit

public void fit(ObservationReal[] o,
                double[] weights)
Fits this observation distribution function to a (non empty) weighted set of observations. This method performs one iteration of an expectation-maximisation algorithm. Equations (53) and (54) of Rabiner's A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition explain how the weights can be used.

Specified by:
fit in interface Opdf<ObservationReal>
Parameters:
o - A set of observations compatible with this function.
weights - The weights associated to the observations.

fit

public void fit(java.util.Collection<? extends ObservationReal> co,
                double[] weights)
Fits this observation distribution function to a (non empty) weighted set of observations. This method performs one iteration of an expectation-maximisation algorithm. Equations (53) and (54) of Rabiner's A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition explain how the weights can be used.

Specified by:
fit in interface Opdf<ObservationReal>
Parameters:
co - A set of observations compatible with this function.
weights - The weights associated to the observations.

clone

public OpdfGaussianMixture clone()
Specified by:
clone in interface Opdf<ObservationReal>
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.text.NumberFormat numberFormat)
Description copied from interface: Opdf
Returns a String describing this distribution.

Specified by:
toString in interface Opdf<ObservationReal>
Parameters:
numberFormat - A formatter used to convert the numbers (e.g. probabilities) to strings.
Returns:
A String describing this distribution.


Copyright © 2004,2005 Jean-Marc François.