org.jscience.computing.kmeans
Class Gaussian

java.lang.Object
  extended by org.jscience.computing.kmeans.Gaussian

public class Gaussian
extends java.lang.Object

This class implements the Gaussian activation function.


Field Summary
static float DEF_MU
          Default value of mu.
static float DEF_SIGMA
          Default value of sigma.
static float MIN_SIGMA
          Minimum value for sigma.
 
Constructor Summary
Gaussian()
          Default constructor.
 
Method Summary
 float getMu()
          Accessor for Gaussian mu (mean) parameter.
 float getOutput(float x)
          Calculate the value of a Gaussian function for a given input.
 float getOutputPrime(float x)
          Calculate the value of the derivative of a Gaussian function for a given input.
 float getSigma()
          Accessor for Gaussian sigma (std. dev.) parameter.
 void initDefaults()
          Initialize the function parameters to their default values.
static void main(java.lang.String[] args)
          DOCUMENT ME!
 void setMu(float m)
          Mutator for Gaussian mu parameter.
 void setSigma(float s)
          Mutator for Gaussian sigma parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_MU

public static final float DEF_MU
Default value of mu.

See Also:
Constant Field Values

MIN_SIGMA

public static final float MIN_SIGMA
Minimum value for sigma.

See Also:
Constant Field Values

DEF_SIGMA

public static final float DEF_SIGMA
Default value of sigma.

See Also:
Constant Field Values
Constructor Detail

Gaussian

public Gaussian()
Default constructor.

Method Detail

getMu

public float getMu()
Accessor for Gaussian mu (mean) parameter.

Returns:
float - the value of mu.

setMu

public void setMu(float m)
Mutator for Gaussian mu parameter.

Parameters:
m - m - the new value for mu.

getSigma

public float getSigma()
Accessor for Gaussian sigma (std. dev.) parameter.

Returns:
float - the value of sigma.

setSigma

public void setSigma(float s)
Mutator for Gaussian sigma parameter.

Parameters:
s - s - the new value for sigma.

initDefaults

public void initDefaults()
Initialize the function parameters to their default values.


getOutput

public float getOutput(float x)
Calculate the value of a Gaussian function for a given input. The Gaussian or normal probability function is given by:
 1                -(x-mu)^2 / (2 * sigma^2)
 y  =  ------------------- *  e
 (2 * pi * sigma)^0.5
 

The variable k1 holds the value of the first term, and k2 holds the value of the 1 / (2 simga^2) term for the current value of sigma.

Parameters:
x - - the input value.
Returns:
float - the corresponding value of y.

getOutputPrime

public float getOutputPrime(float x)
Calculate the value of the derivative of a Gaussian function for a given input. The derivative of the Gaussian function is given by:
 

y'(x) = y(x) * -2k2(x - mu)

The variable k1 holds the value of the first term, and k2 holds the value of the 1 / (2 simga^2) term for the current value of sigma.

Parameters:
x - - the input value.
Returns:
float - the corresponding value of y prime.

main

public static void main(java.lang.String[] args)
DOCUMENT ME!

Parameters:
args - DOCUMENT ME!