de.jstacs.classifier.scoringFunctionBased.logPrior
Class SeparateGaussianLogPrior

java.lang.Object
  extended by de.jstacs.algorithms.optimization.DifferentiableFunction
      extended by de.jstacs.classifier.scoringFunctionBased.logPrior.LogPrior
          extended by de.jstacs.classifier.scoringFunctionBased.logPrior.SeparateLogPrior
              extended by de.jstacs.classifier.scoringFunctionBased.logPrior.SeparateGaussianLogPrior
All Implemented Interfaces:
Function, Storable, Cloneable

public class SeparateGaussianLogPrior
extends SeparateLogPrior

Class for a LogPrior that defines a Gaussian prior on the parameters of a set of NormalizableScoringFunctions and a set of class-parameters. The variances v[i] for a parameter i of a NormalizableScoringFunction fun[j] are determined from the base variance v[j] as
v[i] = v[j]*funs[j].getSizeOfEventSpaceForRandomVariablesOfParameter(j).
The variances for the class parameters are used as defined by the user. The mean-parameters are set to 0 for the parameters of the NormalizableScoringFunctions and to the user-specified means for the class-parameters.

Author:
Jan Grau, Jens Keilwagen

Field Summary
 
Fields inherited from class de.jstacs.classifier.scoringFunctionBased.logPrior.SeparateLogPrior
classMus, classVars, freeParameters, funs, vars
 
Fields inherited from class de.jstacs.classifier.scoringFunctionBased.logPrior.LogPrior
UNKNOWN
 
Constructor Summary
SeparateGaussianLogPrior(double[] vars, double[] classVars, double[] classMus)
          Creates a new SeparateGaussianLogPrior from a set of base variances vars, a set of class-variances classVars, and a set of class-means classMus.
SeparateGaussianLogPrior(StringBuffer xml)
          Re-creates a SeparateGaussianLogPrior from its XML-representation as returned by SeparateLogPrior.toXML().
 
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[] x)
          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.
 void unset()
          Resets all internally pre-computed values, e.g. the hyper-parameters for each parameter.
 
Methods inherited from class de.jstacs.classifier.scoringFunctionBased.logPrior.SeparateLogPrior
getNewInstance, set, toXML
 
Methods inherited from class de.jstacs.classifier.scoringFunctionBased.logPrior.LogPrior
evaluateGradientOfFunction
 
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

SeparateGaussianLogPrior

public SeparateGaussianLogPrior(double[] vars,
                                double[] classVars,
                                double[] classMus)
Creates a new SeparateGaussianLogPrior from a set of base variances vars, a set of class-variances classVars, and a set of class-means classMus.

Parameters:
vars - the base variances for each class
classVars - the class-variances
classMus - the class-means

SeparateGaussianLogPrior

public SeparateGaussianLogPrior(StringBuffer xml)
                         throws NonParsableException
Re-creates a SeparateGaussianLogPrior from its XML-representation as returned by SeparateLogPrior.toXML().

Parameters:
xml - the XML-representation
Throws:
NonParsableException - is thrown if the XML-code could not be parsed
Method Detail

unset

public void unset()
Description copied from class: SeparateLogPrior
Resets all internally pre-computed values, e.g. the hyper-parameters for each parameter.

Specified by:
unset in class SeparateLogPrior

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[] x)
                        throws DimensionException,
                               EvaluationException
Description copied from interface: Function
Evaluates the function at a certain vector (in mathematical sense) x

Parameters:
x - the current vector
Returns:
the elvaluation of the function
Throws:
DimensionException - if dim(x) != n, with f: R^n -> R
EvaluationException - if there was a mistake in evaluating the function

getDimensionOfScope

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

Returns:
dimension of the scope; n, with f: R^n -> R

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