|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.algorithms.optimization.DifferentiableFunction
de.jstacs.classifiers.differentiableSequenceScoreBased.OptimizableFunction
de.jstacs.classifiers.differentiableSequenceScoreBased.AbstractOptimizableFunction
de.jstacs.classifiers.differentiableSequenceScoreBased.AbstractMultiThreadedOptimizableFunction
de.jstacs.classifiers.differentiableSequenceScoreBased.DiffSSBasedOptimizableFunction
public abstract class DiffSSBasedOptimizableFunction
This abstract class is the basis of all multi-threaded OptimizableFunction
s that are based on DifferentiableSequenceScore
s.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.OptimizableFunction |
---|
OptimizableFunction.KindOfParameter |
Field Summary | |
---|---|
protected DoubleList[][] |
dList
These DoubleList s are used during the parallel computation of the gradient. |
protected IntList[][] |
iList
These IntList s are used during the parallel computation of the gradient. |
protected LogPrior |
prior
The prior that is used in this function. |
protected DifferentiableSequenceScore[][] |
score
These DifferentiableSequenceScore s are used during the parallel computation. |
protected int[] |
shortcut
These shortcuts indicate the beginning of a new part in the parameter vector. |
Fields inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.AbstractMultiThreadedOptimizableFunction |
---|
params |
Fields inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.AbstractOptimizableFunction |
---|
cl, clazz, data, freeParams, logClazz, norm, sum, weights |
Constructor Summary | |
---|---|
DiffSSBasedOptimizableFunction(int threads,
DifferentiableSequenceScore[] score,
DataSet[] data,
double[][] weights,
LogPrior prior,
boolean norm,
boolean freeParams)
Creates an instance with the underlying infrastructure. |
Method Summary | |
---|---|
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. |
Methods inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.AbstractMultiThreadedOptimizableFunction |
---|
evaluateFunction, evaluateFunction, evaluateGradientOfFunction, evaluateGradientOfFunction, getNumberOfAvailableProcessors, getNumberOfThreads, joinFunction, joinGradients, setDataAndWeights, setParams, stopThreads |
Methods inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.AbstractOptimizableFunction |
---|
getData, 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 |
Field Detail |
---|
protected int[] shortcut
reset()
.
protected DifferentiableSequenceScore[][] score
DifferentiableSequenceScore
s are used during the parallel computation.
score[t]
contains all DifferentiableSequenceScore
s that are used by thread t
.
protected DoubleList[][] dList
DoubleList
s are used during the parallel computation of the gradient.
dList[t]
contains all DoubleList
s that are used by thread t
.
protected IntList[][] iList
IntList
s are used during the parallel computation of the gradient.
iList[t]
contains all IntList
s that are used by thread t
.
protected LogPrior prior
Constructor Detail |
---|
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 DifferentiableSequenceScore
s that are used for determining the sequences scoresdata
- the array of DataSet
s containing the data that is needed to evaluate the functionweights
- the weights for each Sequence
in each DataSet
of data
prior
- 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 parameters
IllegalArgumentException
- if the number of threads is not positive, the number of classes or the dimension of the weights is not correctMethod Detail |
---|
public final double[] getClassParams(double[] params)
params
- the current parameters
public final int getDimensionOfScope()
Function
Function
.
n
with
protected void setThreadIndependentParameters() throws DimensionException
AbstractMultiThreadedOptimizableFunction
setThreadIndependentParameters
in class AbstractMultiThreadedOptimizableFunction
DimensionException
- if the dimension of the parameters is wrongAbstractMultiThreadedOptimizableFunction.setParams(double[])
public 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)
protected void setParams(int index) throws DimensionException
AbstractMultiThreadedOptimizableFunction
index
setParams
in class AbstractMultiThreadedOptimizableFunction
index
- the index of the thread
DimensionException
- if the parameters could not be setAbstractMultiThreadedOptimizableFunction.params
public 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 instances
Exception
- if something went wrongpublic final void reset() throws Exception
OptimizableFunction
reset
in class OptimizableFunction
Exception
- if something went wrong
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |