Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.classifier.scoringFunctionBased.cll
Class NormConditionalLogLikelihood

    java.lang.Object
      de.jstacs.algorithms.optimization.DifferentiableFunction
          de.jstacs.classifier.scoringFunctionBased.OptimizableFunction
              de.jstacs.classifier.scoringFunctionBased.AbstractOptimizableFunction
                  de.jstacs.classifier.scoringFunctionBased.cll.NormConditionalLogLikelihood

All Implemented Interfaces:
  Function

    public class NormConditionalLogLikelihood

extends AbstractOptimizableFunction

This class implements the normalized log conditional likelihood. It can be used to maximize parameters.

Author:
  Jens Keilwagen

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

### NormConditionalLogLikelihood

    public NormConditionalLogLikelihood(ScoringFunction[] score,
                                        Sample[] data,
                                        double[][] weights,
                                        boolean norm,
                                        boolean freeParams)
                                 throws IllegalArgumentException,
                                        WrongAlphabetException

  The constructor creates an instance of the `NormConditionalLogLikelihood`.

  Parameters:
    `score` - the `ScoringFunction`s
    `data` - the data
    `weights` - the weights
    `norm` - 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`
  Throws:
    `IllegalArgumentException` - if the number of classes is not correct
    `WrongAlphabetException` - if different alphabets are used
  See Also:
    `NormConditionalLogLikelihood(ScoringFunction[], Sample[], double[][], LogPrior, boolean, boolean)`

### NormConditionalLogLikelihood

    public NormConditionalLogLikelihood(ScoringFunction[] score,
                                        Sample[] data,
                                        double[][] weights,
                                        LogPrior prior,
                                        boolean norm,
                                        boolean freeParams)
                                 throws IllegalArgumentException,
                                        WrongAlphabetException

  The constructor creates an instance of the `NormConditionalLogLikelihood` using the given prior.

  Parameters:
    `score` - the `ScoringFunction`s
    `data` - the data
    `weights` - the weights
    `prior` - the prior
    `norm` - 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`
  Throws:
    `IllegalArgumentException` - if the number of classes is not correct
    `WrongAlphabetException` - if different alphabets are used
  See Also:
    `AbstractOptimizableFunction.AbstractOptimizableFunction(Sample[], double[][], boolean, boolean)`

Method Detail

### evaluateGradientOfFunction

    public double[] evaluateGradientOfFunction(double[] x)
                                        throws DimensionException,
                                               EvaluationException

  Description copied from class: `DifferentiableFunction`
  Evaluates the gradient of a function at a certain vector (in mathematical sense) `x`.

  Specified by:
    `evaluateGradientOfFunction` in class `DifferentiableFunction`
  Parameters:
    `x` - the current vector
  Returns:
    the evaluation of the gradient of a function, has dimension `Function.getDimensionOfScope()`
  Throws:
    `DimensionException` - if `dim(x) != n`, with `f: R^n -> R`
    `EvaluationException` - if there was something wrong during the evaluation of the gradient
  See Also:
    `Function.getDimensionOfScope()`

### evaluateFunction

    public double evaluateFunction(double[] x)
                            throws DimensionException,
                                   EvaluationException

  Description copied from interface: `Function`
  Evaluates the function at a certain vector (in mathematical sense) `x`.

  Parameters:
    `x` - the current vector
  Returns:
    the evaluation of the function
  Throws:
    `DimensionException` - if `dim(x) != n`, with `f: R^n -> R`
    `EvaluationException` - if there was something wrong during the evaluation of the function

### getParameters

    public void getParameters(OptimizableFunction.KindOfParameter kind,
                              double[] erg)
                       throws Exception

  Description copied from class: `AbstractOptimizableFunction`
  This method enables the user to get the parameters without creating a new array.

  Specified by:
    `getParameters` in class `AbstractOptimizableFunction`
  Parameters:
    `kind` - the kind of the class parameters to be returned in `erg`
    `erg` - the array for the start parameters
  Throws:
    `Exception` - if the array is `null` or does not have the correct length
  See Also:
    `OptimizableFunction.getParameters(KindOfParameter)`

### setParams

    public void setParams(double[] params)
                   throws DimensionException

  Description copied from class: `AbstractOptimizableFunction`
  Checks the dimension and sets the class parameters.

  Overrides:
    `setParams` in class `AbstractOptimizableFunction`
  Parameters:
    `params` - the current values
  Throws:
    `DimensionException` - if the dimension of the current values does not match with the dimension of the internal parameters

### getNumberOfStarts

    public int getNumberOfStarts()

  Description copied from class: `OptimizableFunction`
  Returns the number of starts that should be done for a good optimum. For concave or convex functions this number should be 1.

  Specified by:
    `getNumberOfStarts` in class `OptimizableFunction`
  Returns:
    the number of times the `Optimizer` should be started to get a good optimum
  See Also:
    `Optimizer`

### reset

    public void reset(ScoringFunction[] funs)
               throws Exception

  Description copied from class: `OptimizableFunction`
  Resets the `ScoringFunction`s and all pre-computed values.

  Specified by:
    `reset` in class `OptimizableFunction`
  Parameters:
    `funs` - the array of `ScoringFunction`s
  Throws:
    `Exception` - if something went wrong

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD