public class CompositeLogPrior extends LogPrior
DifferentiableStatisticalModel
,
DifferentiableStatisticalModel.addGradientOfLogPriorTerm(double[], int)
,
DifferentiableStatisticalModel.getLogPriorTerm()
Constructor and Description |
---|
CompositeLogPrior()
The main constructor.
|
CompositeLogPrior(StringBuffer xml)
The constructor for the
Storable interface. |
Modifier and Type | Method and Description |
---|---|
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.
|
CompositeLogPrior |
getNewInstance()
This method returns an empty new instance of the current prior.
|
void |
set(boolean freeParameters,
DifferentiableSequenceScore... funs)
Resets all pre-computed values to their initial values using the
DifferentiableSequenceScore s funs . |
StringBuffer |
toXML()
Encodes the prior as an XML representation.
|
evaluateGradientOfFunction
findOneDimensionalMin
public CompositeLogPrior()
public CompositeLogPrior(StringBuffer xml)
Storable
interface.xml
- the StringBufferpublic void set(boolean freeParameters, DifferentiableSequenceScore... funs) throws Exception
LogPrior
DifferentiableSequenceScore
s funs
.set
in class LogPrior
freeParameters
- the switch for using only the free parameters or all
parameters in a DifferentiableSequenceScore
funs
- the DifferentiableSequenceScore
s for the priorException
- if the DifferentiableSequenceScore
s could not be setpublic void addGradientFor(double[] params, double[] grad) throws EvaluationException
LogPrior
addGradientFor
in class LogPrior
params
- the parametersgrad
- the vectorEvaluationException
- if the gradient could not be evaluatedpublic 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 CompositeLogPrior getNewInstance() throws CloneNotSupportedException
LogPrior
DifferentiableSequenceScore
s that may be inside the instance. The DifferentiableSequenceScore
s must be
set by an invocation of the method
LogPrior.set(boolean, DifferentiableSequenceScore...)
.getNewInstance
in class LogPrior
CloneNotSupportedException
- if something went wrong while cloningLogPrior.set(boolean, DifferentiableSequenceScore...)
public StringBuffer toXML()
LogPrior
LogPrior.set(boolean, DifferentiableSequenceScore...)
has to be invoked after decoding.public String getInstanceName()
LogPrior
getInstanceName
in class LogPrior