|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.algorithms.optimization.DifferentiableFunction
de.jstacs.classifier.scoringFunctionBased.OptimizableFunction
de.jstacs.classifier.scoringFunctionBased.AbstractOptimizableFunction
de.jstacs.classifier.scoringFunctionBased.cll.NormConditionalLogLikelihood
public class NormConditionalLogLikelihood
This class implements the normalized log conditional likelihood. It can be used to maximize parameters.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.jstacs.classifier.scoringFunctionBased.OptimizableFunction |
---|
OptimizableFunction.KindOfParameter |
Field Summary |
---|
Fields inherited from class de.jstacs.classifier.scoringFunctionBased.AbstractOptimizableFunction |
---|
cl, clazz, data, freeParams, logClazz, norm, shortcut, sum, weights |
Constructor Summary | |
---|---|
NormConditionalLogLikelihood(ScoringFunction[] score,
Sample[] data,
double[][] weights,
boolean norm,
boolean freeParams)
The constructor creates an instance of the NormConditionalLogLikelihood . |
|
NormConditionalLogLikelihood(ScoringFunction[] score,
Sample[] data,
double[][] weights,
LogPrior prior,
boolean norm,
boolean freeParams)
The constructor creates an instance of the NormConditionalLogLikelihood using the given prior. |
Method Summary | |
---|---|
double |
evaluateFunction(double[] x)
Evaluates the function at a certain vector (in mathematical sense) x . |
double[] |
evaluateGradientOfFunction(double[] x)
Evaluates the gradient of a function at a certain vector (in mathematical sense) x . |
int |
getNumberOfStarts()
Returns the number of starts that should be done for a good optimum. |
void |
getParameters(OptimizableFunction.KindOfParameter kind,
double[] erg)
This method enables the user to get the parameters without creating a new array. |
void |
reset(ScoringFunction[] funs)
Resets the ScoringFunction s and all pre-computed values. |
void |
setParams(double[] params)
Checks the dimension and sets the class parameters. |
Methods inherited from class de.jstacs.classifier.scoringFunctionBased.AbstractOptimizableFunction |
---|
addTermToClassParameter, getClassParams, getData, getDimensionOfScope, getNumberOfStarts, getParameters, getSequenceWeights |
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 |
---|
public NormConditionalLogLikelihood(ScoringFunction[] score, Sample[] data, double[][] weights, boolean norm, boolean freeParams) throws IllegalArgumentException, WrongAlphabetException
NormConditionalLogLikelihood
.
score
- the ScoringFunction
sdata
- the dataweights
- the weightsnorm
- the switch for using the normalization (division by the number
of sequences)freeParams
- the switch for using only the free parameters or all
parameters in a ScoringFunction
IllegalArgumentException
- if the number of classes is not correct
WrongAlphabetException
- if different alphabets are usedNormConditionalLogLikelihood(ScoringFunction[],
Sample[], double[][], LogPrior, boolean, boolean)
public NormConditionalLogLikelihood(ScoringFunction[] score, Sample[] data, double[][] weights, LogPrior prior, boolean norm, boolean freeParams) throws IllegalArgumentException, WrongAlphabetException
NormConditionalLogLikelihood
using the given prior.
score
- the ScoringFunction
sdata
- the dataweights
- the weightsprior
- the priornorm
- the switch for using the normalization (division by the number
of sequences)freeParams
- the switch for using only the free parameters or all
parameters in a ScoringFunction
IllegalArgumentException
- if the number of classes is not correct
WrongAlphabetException
- if different alphabets are usedAbstractOptimizableFunction.AbstractOptimizableFunction(Sample[],
double[][], boolean, boolean)
Method Detail |
---|
public double[] evaluateGradientOfFunction(double[] x) throws DimensionException, EvaluationException
DifferentiableFunction
x
.
evaluateGradientOfFunction
in class DifferentiableFunction
x
- the current vector
Function.getDimensionOfScope()
DimensionException
- if dim(x) != n
, with f: R^n -> R
EvaluationException
- if there was something wrong during the evaluation of the
gradientFunction.getDimensionOfScope()
public double evaluateFunction(double[] x) throws DimensionException, EvaluationException
Function
x
.
x
- the current vector
DimensionException
- if dim(x) != n
, with f: R^n -> R
EvaluationException
- if there was something wrong during the evaluation of the
functionpublic void getParameters(OptimizableFunction.KindOfParameter kind, double[] erg) throws Exception
AbstractOptimizableFunction
getParameters
in class AbstractOptimizableFunction
kind
- the kind of the class parameters to be returned in
erg
erg
- the array for the start parameters
Exception
- if the array is null
or does not have the
correct lengthOptimizableFunction.getParameters(KindOfParameter)
public void setParams(double[] params) throws DimensionException
AbstractOptimizableFunction
setParams
in class AbstractOptimizableFunction
params
- the current values
DimensionException
- if the dimension of the current values does not match with
the dimension of the internal parameterspublic int getNumberOfStarts()
OptimizableFunction
getNumberOfStarts
in class OptimizableFunction
Optimizer
should be
started to get a good optimumOptimizer
public void reset(ScoringFunction[] funs) throws Exception
OptimizableFunction
ScoringFunction
s and all pre-computed values.
reset
in class OptimizableFunction
funs
- the array of ScoringFunction
s
Exception
- if something went wrong
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |