public abstract class DiffSSBasedOptimizableFunction extends AbstractMultiThreadedOptimizableFunction
OptimizableFunctions that are based on DifferentiableSequenceScores.OptimizableFunction.KindOfParameter| Modifier and Type | Field and Description |
|---|---|
protected DoubleList[][] |
dList
These
DoubleLists are used during the parallel computation of the gradient. |
protected IntList[][] |
iList
These
IntLists are used during the parallel computation of the gradient. |
protected LogPrior |
prior
The prior that is used in this function.
|
protected DifferentiableSequenceScore[][] |
score
These
DifferentiableSequenceScores are used during the parallel computation. |
protected int[] |
shortcut
These shortcuts indicate the beginning of a new part in the parameter vector.
|
params, workercl, clazz, data, freeParams, logClazz, norm, sum, weights| Constructor and Description |
|---|
DiffSSBasedOptimizableFunction(int threads,
DifferentiableSequenceScore[] score,
DataSet[] data,
double[][] weights,
LogPrior prior,
boolean norm,
boolean freeParams)
Creates an instance with the underlying infrastructure.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTermToClassParameter(int classIndex,
double term)
This method adds the
term to the class parameter of the
class with index classIndex. |
double[] |
getClassParams(double[] params)
Returns from the complete vector of parameters those that are for the
classes.
|
int |
getDimensionOfScope()
Returns the dimension of the scope of the
Function. |
void |
getParameters(OptimizableFunction.KindOfParameter kind,
double[] erg)
This method enables the user to get the parameters without creating a new
array.
|
void |
reset()
Resets the all objects and pre-computed values.
|
abstract void |
reset(DifferentiableSequenceScore[] funs)
This method allows to reset the internally used functions and the corresponding objects.
|
protected void |
setParams(int index)
This method sets the parameters for thread
index |
protected void |
setThreadIndependentParameters()
This method allows to set thread independent parameters.
|
evaluateFunction, evaluateFunction, evaluateGradientOfFunction, evaluateGradientOfFunction, getNumberOfAvailableProcessors, getNumberOfThreads, joinFunction, joinGradients, prepareThreads, setDataAndWeights, setParams, stopThreadsgetData, getParameters, getSequenceWeightsfindOneDimensionalMinprotected int[] shortcut
reset().protected DifferentiableSequenceScore[][] score
DifferentiableSequenceScores are used during the parallel computation.
score[t] contains all DifferentiableSequenceScores that are used by thread t.protected DoubleList[][] dList
DoubleLists are used during the parallel computation of the gradient.
dList[t] contains all DoubleLists that are used by thread t.protected IntList[][] iList
protected LogPrior prior
public DiffSSBasedOptimizableFunction(int threads,
DifferentiableSequenceScore[] score,
DataSet[] data,
double[][] weights,
LogPrior prior,
boolean norm,
boolean freeParams)
throws IllegalArgumentException
reset().threads - the number of threads used for evaluating the function and determining the gradient of the functionscore - an array containing the DifferentiableSequenceScores that are used for determining the sequences scoresdata - the array of DataSets containing the data that is needed to evaluate the functionweights - the weights for each Sequence in each DataSet of dataprior - the prior that is used for learning the parametersnorm - the switch for using the normalization (division by the number
of sequences)freeParams - the switch for using only the free parametersIllegalArgumentException - if the number of threads is not positive, the number of classes or the dimension of the weights is not correctpublic final double[] getClassParams(double[] params)
params - the current parameterspublic final int getDimensionOfScope()
FunctionFunction.n with

protected void setThreadIndependentParameters()
throws DimensionException
AbstractMultiThreadedOptimizableFunctionsetThreadIndependentParameters in class AbstractMultiThreadedOptimizableFunctionDimensionException - if the dimension of the parameters is wrongAbstractMultiThreadedOptimizableFunction.setParams(double[])public void getParameters(OptimizableFunction.KindOfParameter kind, double[] erg) throws Exception
AbstractOptimizableFunctiongetParameters in class AbstractOptimizableFunctionkind - the kind of the class parameters to be returned in
ergerg - the array for the start parametersException - if the array is null or does not have the
correct lengthOptimizableFunction.getParameters(KindOfParameter)protected void setParams(int index)
throws DimensionException
AbstractMultiThreadedOptimizableFunctionindexsetParams in class AbstractMultiThreadedOptimizableFunctionindex - the index of the threadDimensionException - if the parameters could not be setAbstractMultiThreadedOptimizableFunction.paramspublic final void addTermToClassParameter(int classIndex,
double term)
term to the class parameter of the
class with index classIndex.classIndex - the index of the classterm - the term to be added to the class parameterpublic abstract void reset(DifferentiableSequenceScore[] funs) throws Exception
funs - the new instancesException - if something went wrongpublic final void reset()
throws Exception
OptimizableFunctionreset in class OptimizableFunctionException - if something went wrong