|
||||||||||
| 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
public abstract class AbstractOptimizableFunction
This class extends OptimizableFunction and implements some common
methods.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class de.jstacs.classifier.scoringFunctionBased.OptimizableFunction |
|---|
OptimizableFunction.KindOfParameter |
| Field Summary | |
|---|---|
protected int |
cl
The number of different classes. |
protected double[] |
clazz
The class parameters. |
protected Sample[] |
data
The data that is used to evaluate this function. |
protected boolean |
freeParams
Whether only the free parameters or all should be used. |
protected double[] |
logClazz
The logarithm of the class parameters. |
protected boolean |
norm
Whether a normalization should be done or not. |
protected int[] |
shortcut
These shortcuts indicate the beginning of a new part in the parameter vector. |
protected double[] |
sum
The sums of the weighted data per class and additional the total weight sum. |
protected double[][] |
weights
The weights for the data. |
| Constructor Summary | |
|---|---|
protected |
AbstractOptimizableFunction(Sample[] data,
double[][] weights,
boolean norm,
boolean freeParams)
The constructor creates an instance using the given weighted data. |
| Method Summary | |
|---|---|
void |
addTermToClassParameter(int classIndex,
double term)
This method adds the term to the class parameter. |
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. |
protected int |
getNumberOfStarts(ScoringFunction[] score)
Returns the number of recommended starts. |
double[] |
getParameters(OptimizableFunction.KindOfParameter kind)
Returns some parameters that can be used for instance as start parameters. |
abstract void |
getParameters(OptimizableFunction.KindOfParameter kind,
double[] erg)
This method enables the user to get the parameters without creating a new array. |
void |
setParams(double[] params)
Checks the dimension and sets the class parameters. |
| Methods inherited from class de.jstacs.classifier.scoringFunctionBased.OptimizableFunction |
|---|
getNumberOfStarts, reset |
| Methods inherited from class de.jstacs.algorithms.optimization.DifferentiableFunction |
|---|
evaluateGradientOfFunction, findOneDimensionalMin |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.jstacs.algorithms.optimization.Function |
|---|
evaluateFunction |
| Field Detail |
|---|
protected int[] shortcut
protected Sample[] data
protected double[][] weights
dataprotected double[] clazz
protected double[] logClazz
clazzprotected double[] sum
data,
weightsprotected int cl
protected boolean norm
protected boolean freeParams
| Constructor Detail |
|---|
protected AbstractOptimizableFunction(Sample[] data,
double[][] weights,
boolean norm,
boolean freeParams)
throws IllegalArgumentException,
WrongAlphabetException
data - 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
IllegalArgumentException - if the number of classes is not correct
WrongAlphabetException - if different alphabets are used| Method Detail |
|---|
public final int getDimensionOfScope()
Function
public abstract void getParameters(OptimizableFunction.KindOfParameter kind,
double[] erg)
throws Exception
kind - 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)
public final double[] getParameters(OptimizableFunction.KindOfParameter kind)
throws Exception
OptimizableFunction
getParameters in class OptimizableFunctionkind - the kind of the class parameters that will be returned
Exception - if something went wrong
public void setParams(double[] params)
throws DimensionException
setParams in class OptimizableFunctionparams - the current values
DimensionException - if the dimension of the current values does not match with
the internal parameterspublic final double[] getClassParams(double[] params)
OptimizableFunction
getClassParams in class OptimizableFunctionparams - the current parameters
protected final int getNumberOfStarts(ScoringFunction[] score)
score - the underlying scoring functions
OptimizableFunction.getNumberOfStarts()
public final void addTermToClassParameter(int classIndex,
double term)
OptimizableFunctionterm to the class parameter.
addTermToClassParameter in class OptimizableFunctionclassIndex - the index of the classterm - the term to be added
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||