edu.umd.cloud9.example.clustering
Class UnivariateGaussianMixtureModel

java.lang.Object
  extended by edu.umd.cloud9.example.clustering.UnivariateGaussianMixtureModel

public class UnivariateGaussianMixtureModel
extends Object


Field Summary
 PVector[] param
           
 int[] pos
           
 int size
           
 double[] weight
           
 
Constructor Summary
UnivariateGaussianMixtureModel()
          Class constructor.
UnivariateGaussianMixtureModel(int n)
           
 
Method Summary
 UnivariateGaussianMixtureModel clone()
          Creates and returns a copy of the instance.
 double density(Point x)
          Computes the density value of this mixture value.
static double densityOfGaussian(Point x, PVector param)
          Computes the density value \f$ f(x;\mu,\sigma^2) \f$.
static Point drawRandomPointFromGaussian(PVector L)
          Draws a point from the considered distribution.
 Point[] drawRandomPoints(int m)
          Draws points from the considered mixture model.
 int getDimension()
          Return the dimension of the parameters of the mixture model.
 void normalizeWeights()
          Normalizes the weights of the mixture models \f$ \alpha_i \f$ such as \f$ \sum_{i=1}^n \alpha_i = 1 \f$.
 void setSize(int n)
           
 String toString()
          Method toString.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

size

public int size

weight

public double[] weight

pos

public int[] pos

param

public PVector[] param
Constructor Detail

UnivariateGaussianMixtureModel

public UnivariateGaussianMixtureModel()
Class constructor.

Parameters:
n - number of components in the mixture model

UnivariateGaussianMixtureModel

public UnivariateGaussianMixtureModel(int n)
Method Detail

setSize

public void setSize(int n)

density

public double density(Point x)
Computes the density value of this mixture value.

Parameters:
x - a point
Returns:
density value of this mixture value

normalizeWeights

public void normalizeWeights()
Normalizes the weights of the mixture models \f$ \alpha_i \f$ such as \f$ \sum_{i=1}^n \alpha_i = 1 \f$.


toString

public String toString()
Method toString.

Overrides:
toString in class Object
Returns:
string describing the mixture model

clone

public UnivariateGaussianMixtureModel clone()
Creates and returns a copy of the instance.

Overrides:
clone in class Object
Returns:
a clone of the instance

getDimension

public int getDimension()
Return the dimension of the parameters of the mixture model.

Returns:
parameters's dimension

drawRandomPoints

public Point[] drawRandomPoints(int m)
Draws points from the considered mixture model.

Parameters:
m - number of points to draw
Returns:
a point

densityOfGaussian

public static double densityOfGaussian(Point x,
                                       PVector param)
Computes the density value \f$ f(x;\mu,\sigma^2) \f$.

Parameters:
x - point
param - parameters (source, natural, or expectation)
Returns:
\f$ f(x;\mu,\sigma^2) = \frac{1}{ \sqrt{2\pi \sigma^2} } \exp \left( - \frac{(x-\mu)^2}{ 2 \sigma^2} \right) \f$

drawRandomPointFromGaussian

public static Point drawRandomPointFromGaussian(PVector L)
Draws a point from the considered distribution.

Parameters:
L - source parameters \f$ \mathbf{\Lambda} = ( \mu , \sigma^2 )\f$
Returns:
a point