public class SeparateLaplaceLogPrior extends SeparateLogPrior
LogPrior
that defines a Laplace prior on the parameters
of a set of DifferentiableStatisticalModel
s
and a set of class parameters. The scale hyperparameters of the Laplace prior
are determined from a set of class-specific base variances and the class
variances, respectively. The formula to determine the shape hyperparameter
b[i]
for a parameter i
from a variance
v[i]
isb[i] = Math.sqrt(v[i]/2)
.v[i]
for a parameter i
of a
DifferentiableStatisticalModel
fun[j]
are determined from the base variance v[j]
asv[i] = v[j]*funs[j].getSizeOfEventSpaceForRandomVariablesOfParameter(j)
.DifferentiableStatisticalModel
s and to the
user-specified means for the class parameters.classMus, classVars, freeParameters, funs, vars
Constructor and Description |
---|
SeparateLaplaceLogPrior(double[] vars,
double[] classVars,
double[] classMus)
Creates a new
SeparateLaplaceLogPrior from a set of base
variances vars , a set of class variances
classVars and a set of class means classMus . |
SeparateLaplaceLogPrior(StringBuffer xml)
The standard constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
void |
addGradientFor(double[] params,
double[] vector)
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.
|
protected void |
unset()
Resets all internally pre-computed values, e.g.
|
getNewInstance, set, toXML
evaluateGradientOfFunction
findOneDimensionalMin
public SeparateLaplaceLogPrior(double[] vars, double[] classVars, double[] classMus)
SeparateLaplaceLogPrior
from a set of base
variances vars
, a set of class variances
classVars
and a set of class means classMus
.vars
- the base variances for each classclassVars
- the class variancesclassMus
- the class meansSeparateLogPrior.SeparateLogPrior(double[], double[], double[])
public SeparateLaplaceLogPrior(StringBuffer xml) throws NonParsableException
Storable
.
Creates a new SeparateLaplaceLogPrior
out of its XML
representation.xml
- the XML representation as StringBuffer
NonParsableException
- if the SeparateLaplaceLogPrior
could not be
reconstructed out of the XML representation (the
StringBuffer
could not be parsed)SeparateLogPrior.SeparateLogPrior(StringBuffer)
,
Storable
protected void unset()
SeparateLogPrior
unset
in class SeparateLogPrior
public void addGradientFor(double[] params, double[] vector)
LogPrior
addGradientFor
in class LogPrior
params
- the parametersvector
- the vectorpublic double evaluateFunction(double[] x) throws DimensionException, EvaluationException
Function
x
.x
- the current vectorDimensionException
- if dim(x) != n
, with EvaluationException
- if there was something wrong during the evaluation of the
functionpublic int getDimensionOfScope()
Function
Function
.n
with
public String getInstanceName()
LogPrior
getInstanceName
in class LogPrior