de.jstacs.classifiers.differentiableSequenceScoreBased.logPrior
Class SimpleGaussianSumLogPrior

java.lang.Object
  extended by de.jstacs.algorithms.optimization.DifferentiableFunction
      extended by de.jstacs.classifiers.differentiableSequenceScoreBased.logPrior.LogPrior
          extended by de.jstacs.classifiers.differentiableSequenceScoreBased.logPrior.SimpleGaussianSumLogPrior
All Implemented Interfaces:
Function, Storable

public class SimpleGaussianSumLogPrior
extends LogPrior

This class implements a prior that is a product of Gaussian distributions with mean 0 and equal variance for each parameter.

Author:
Jens Keilwagen

Field Summary
 
Fields inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.logPrior.LogPrior
UNKNOWN
 
Constructor Summary
SimpleGaussianSumLogPrior(double sigma)
          Creates a new SimpleGaussianSumLogPrior with mean 0 and variance sigma for all parameters, including the class parameters.
SimpleGaussianSumLogPrior(StringBuffer xml)
          The standard constructor for the interface Storable.
 
Method Summary
 void addGradientFor(double[] params, double[] grad)
          Adds the gradient of the log-prior using the current parameters to a given vector.
 double evaluateFunction(double[] params)
          Evaluates the function at a certain vector (in mathematical sense) x.
 int getDimensionOfScope()
          Returns the dimension of the scope of the Function.
 String getInstanceName()
          Returns a short instance name.
 SimpleGaussianSumLogPrior getNewInstance()
          This method returns an empty new instance of the current prior.
 StringBuffer toXML()
          Encodes the prior as an XML representation.
 
Methods inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.logPrior.LogPrior
evaluateGradientOfFunction, set
 
Methods inherited from class de.jstacs.algorithms.optimization.DifferentiableFunction
findOneDimensionalMin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleGaussianSumLogPrior

public SimpleGaussianSumLogPrior(double sigma)
Creates a new SimpleGaussianSumLogPrior with mean 0 and variance sigma for all parameters, including the class parameters.

Parameters:
sigma - the variance

SimpleGaussianSumLogPrior

public SimpleGaussianSumLogPrior(StringBuffer xml)
                          throws NonParsableException
The standard constructor for the interface Storable. Creates a new SimpleGaussianSumLogPrior out of its XML representation.

Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the SimpleGaussianSumLogPrior could not be reconstructed out of the XML representation (the StringBuffer could not be parsed)
See Also:
Storable
Method Detail

addGradientFor

public void addGradientFor(double[] params,
                           double[] grad)
Description copied from class: LogPrior
Adds the gradient of the log-prior using the current parameters to a given vector.

Specified by:
addGradientFor in class LogPrior
Parameters:
params - the parameters
grad - the vector

evaluateFunction

public double evaluateFunction(double[] params)
Description copied from interface: Function
Evaluates the function at a certain vector (in mathematical sense) x.

Parameters:
params - the current vector
Returns:
the evaluation of the function

getDimensionOfScope

public int getDimensionOfScope()
Description copied from interface: Function
Returns the dimension of the scope of the Function.

Returns:
the dimension of the scope: n with $f: \mathbb{R}^n \to \mathbb{R}$

getNewInstance

public SimpleGaussianSumLogPrior getNewInstance()
                                         throws CloneNotSupportedException
Description copied from class: LogPrior
This method returns an empty new instance of the current prior. The method works similar to clone, but does not clone DifferentiableSequenceScore s that may be inside the instance. The DifferentiableSequenceScores must be set by an invocation of the method LogPrior.set(boolean, DifferentiableSequenceScore...).

Specified by:
getNewInstance in class LogPrior
Returns:
a new empty instance of the prior
Throws:
CloneNotSupportedException - if something went wrong while cloning
See Also:
LogPrior.set(boolean, DifferentiableSequenceScore...)

toXML

public StringBuffer toXML()
Description copied from class: LogPrior
Encodes the prior as an XML representation. It does not encode all information, since the method LogPrior.set(boolean, DifferentiableSequenceScore...) has to be invoked after decoding.

Specified by:
toXML in interface Storable
Specified by:
toXML in class LogPrior
Returns:
the XML representation;

getInstanceName

public String getInstanceName()
Description copied from class: LogPrior
Returns a short instance name.

Specified by:
getInstanceName in class LogPrior
Returns:
a short instance name