|
||||||||||
| 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.AbstractMultiThreadedOptimizableFunction
de.jstacs.classifier.scoringFunctionBased.SFBasedOptimizableFunction
public abstract class SFBasedOptimizableFunction
This abstract class is the basis of all multi-threaded OptimizableFunctions that are based on ScoringFunctions.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class de.jstacs.classifier.scoringFunctionBased.OptimizableFunction |
|---|
OptimizableFunction.KindOfParameter |
| Field Summary | |
|---|---|
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 ScoringFunction[][] |
score
These ScoringFunctions 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.classifier.scoringFunctionBased.AbstractMultiThreadedOptimizableFunction |
|---|
params |
| Fields inherited from class de.jstacs.classifier.scoringFunctionBased.AbstractOptimizableFunction |
|---|
cl, clazz, data, freeParams, logClazz, norm, sum, weights |
| Constructor Summary | |
|---|---|
SFBasedOptimizableFunction(int threads,
ScoringFunction[] score,
Sample[] 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(ScoringFunction[] 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.classifier.scoringFunctionBased.AbstractMultiThreadedOptimizableFunction |
|---|
evaluateFunction, evaluateFunction, evaluateGradientOfFunction, evaluateGradientOfFunction, getNumberOfAvailableProcessors, getNumberOfThreads, joinFunction, joinGradients, setDataAndWeights, setParams, stopThreads |
| Methods inherited from class de.jstacs.classifier.scoringFunctionBased.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 ScoringFunction[][] score
ScoringFunctions are used during the parallel computation.
score[t] contains all ScoringFunctions 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
IntLists are used during the parallel computation of the gradient.
iList[t] contains all IntLists that are used by thread t.
protected LogPrior prior
| Constructor Detail |
|---|
public SFBasedOptimizableFunction(int threads,
ScoringFunction[] score,
Sample[] 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 ScoringFunctions that are used for determining the sequences scoresdata - the array of Samples containing the data that is needed to evaluate the functionweights - the weights for each Sequence in each Sample 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 parameters
IllegalArgumentException - if the number of threads is not positive, the number of classes or the dimension of the weights is not correct| Method Detail |
|---|
public final double[] getClassParams(double[] params)
params - the current parameters
public final int getDimensionOfScope()
FunctionFunction.
n with
f: R^n -> R
protected void setThreadIndependentParameters()
throws DimensionException
AbstractMultiThreadedOptimizableFunction
setThreadIndependentParameters in class AbstractMultiThreadedOptimizableFunctionDimensionException - if the dimension of the parameters is wrongAbstractMultiThreadedOptimizableFunction.setParams(double[])
public void getParameters(OptimizableFunction.KindOfParameter kind,
double[] erg)
throws Exception
AbstractOptimizableFunction
getParameters in class AbstractOptimizableFunctionkind - the kind of the class parameters to be returned in
ergerg - 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
AbstractMultiThreadedOptimizableFunctionindex
setParams in class AbstractMultiThreadedOptimizableFunctionindex - 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 parameter
public abstract void reset(ScoringFunction[] funs)
throws Exception
funs - the new instances
Exception - if something went wrong
public final void reset()
throws Exception
OptimizableFunction
reset in class OptimizableFunctionException - if something went wrong
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||