Class ScalableGaussianOptimizationFunction

java.lang.Object
  extended by ScalableGaussianOptimizationFunction
All Implemented Interfaces:
edu.stanford.rsl.jpop.GradientOptimizableFunction, edu.stanford.rsl.jpop.OptimizableFunction, GaussianOptimizationFunction
Direct Known Subclasses:
SimpleGaussianOptimizationFunction

public class ScalableGaussianOptimizationFunction
extends java.lang.Object
implements GaussianOptimizationFunction

This class provides an optimizable function for the JPOP framework (http://www5.cs.fau.de/research/software/java-parallel-optimization-package/ or http://peaks.informatik.uni-erlangen.de/jpop-api/overview-summary.html.

The goal is to model a given set of values with a sum of three scalable Gaussian functions and optimize the parameters of these Gaussian functions via the sum of squared differences. The following parameters are optimized: Mean (\mu_i), standard deviation (\sigma_i) and scaling factor (\alpha_i) for each Gaussian function.

Formula: Sum of three Gaussians (in latex):
g_s(x) = \sum_{k=1}^{3} \alpha_k \mathcal{N}(x; \mu_k, \sigma_k)
Formula: Optimization function:
h_s(\theta_s) = \sum_{i = 1}^{N} (f(x_i)-g_s(x_i))^2 --> minimum
with \theta_s = (\mu_1, \sigma_1, \mu_2, \sigma_2, \mu_3, \sigma_3, \alpha_1, \alpha_2, \alpha_3)

Except not noted otherwise in the method description, these parameters must have the same order as shown in the line above and will have the same order in the array that contains the final result of the optimization process.

Note and TODO: The parameter indices and their position in the resp. arrays might differ because Java arrays start with 0, but in the notation the indices 1 - 3 are used. The descriptions might not be completely consistent due to this reason.


Constructor Summary
ScalableGaussianOptimizationFunction()
           
ScalableGaussianOptimizationFunction(double[] xvalues, double[] yvalues)
          Constructs a new Optimization function.
 
Method Summary
 double evaluate(double[] params, int block)
          Evaluates the optimization function h_s (see class description) for the parameters (= at the position) params for the Gaussian functions.
 double evaluateBasisFunction(double x, double[] params)
          Evaluates the function g_s (see class description) at position x.
 int getNumberOfProcessingBlocks()
          returns the number of parallel processing blocks.
 double[] gradient(double[] params, int block)
          Computes the Gradient at position x.
 void setNumberOfProcessingBlocks(int number)
          Sets the number of parallel processing blocks.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalableGaussianOptimizationFunction

public ScalableGaussianOptimizationFunction(double[] xvalues,
                                            double[] yvalues)
Constructs a new Optimization function. If at least one of the value-arrays is null, the result is a "dummy function" - so you can call evaluateBasisFunction(..) with given parameters to get the function value at the corresponding position.

Parameters:
xvalues - (x_i): Array with the positions where you have corresponding measurements (in yvalues) - both arrays must have the same length.
yvalues - (f(x_i)): y-values/f(x) values corresponding to the positions in xvalues.

ScalableGaussianOptimizationFunction

public ScalableGaussianOptimizationFunction()
Method Detail

setNumberOfProcessingBlocks

public void setNumberOfProcessingBlocks(int number)
Description copied from interface: edu.stanford.rsl.jpop.OptimizableFunction
Sets the number of parallel processing blocks. This number should optimally equal to the number of available processors in the current machine. Default value should be 1.

Specified by:
setNumberOfProcessingBlocks in interface edu.stanford.rsl.jpop.OptimizableFunction

getNumberOfProcessingBlocks

public int getNumberOfProcessingBlocks()
Description copied from interface: edu.stanford.rsl.jpop.OptimizableFunction
returns the number of parallel processing blocks.

Specified by:
getNumberOfProcessingBlocks in interface edu.stanford.rsl.jpop.OptimizableFunction
Returns:

evaluate

public double evaluate(double[] params,
                       int block)
Evaluates the optimization function h_s (see class description) for the parameters (= at the position) params for the Gaussian functions.

Specified by:
evaluate in interface edu.stanford.rsl.jpop.OptimizableFunction
Parameters:
params - = {\mu_1, \sigma_1, \mu_2, \sigma_2, \mu_3, \sigma_3, \alpha_1, \alpha_2, \alpha_3}
block - the block identifier. First block is 0. block is < getNumberOfProcessingBlocks().
Returns:
the function value at x

gradient

public double[] gradient(double[] params,
                         int block)
Description copied from interface: edu.stanford.rsl.jpop.GradientOptimizableFunction
Computes the Gradient at position x. (Note that x is a Fortran Array which starts at 1.)

Specified by:
gradient in interface edu.stanford.rsl.jpop.GradientOptimizableFunction
Parameters:
params - the position
block - the block identifier. First block is 0. block is < getNumberOfProcessingBlocks().
Returns:
the gradient at x. (In Fortran Style)

evaluateBasisFunction

public double evaluateBasisFunction(double x,
                                    double[] params)
Evaluates the function g_s (see class description) at position x.

Specified by:
evaluateBasisFunction in interface GaussianOptimizationFunction
Parameters:
x -
params - The parameters for the three Gaussians. params = {\mu_1, \sigma_1, \mu_2, \sigma_2, \mu_3, \sigma_3, \alpha_1, \alpha_2, \alpha_3}