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.logPrior
Class SeparateLogPrior

    java.lang.Object
      de.jstacs.algorithms.optimization.DifferentiableFunction
          de.jstacs.classifier.scoringFunctionBased.logPrior.LogPrior
              de.jstacs.classifier.scoringFunctionBased.logPrior.SeparateLogPrior

All Implemented Interfaces:
  Function, Storable, Cloneable

Direct Known Subclasses:
  SeparateGaussianLogPrior, SeparateLaplaceLogPrior

    public abstract class SeparateLogPrior

extends LogPrior
implements Cloneable

Abstract class for priors that penalize each parameter value independently and have some variance (and possible mean) as hyperparameters. Such priors are e.g. the `SeparateGaussianLogPrior` or the `SeparateLaplaceLogPrior`.

Author:
  Jan Grau, Jens Keilwagen

Field Summary
`protected double[]` | `classMus` The means for the class parameters, as specified by the user
`protected double[]` | `classVars` The variances for the class parameters, as specified by the user
`protected boolean` | `freeParameters` Indicates, if only free parameters shall be used and hence penalized
`protected NormalizableScoringFunction[]` | `funs` The `ScoringFunction`s using the parameters that shall be penalized
`protected double[]` | `vars` The base variances for the parameters of the `ScoringFunction`s of each class, the means of the non-class parameters should be 0

Fields inherited from class de.jstacs.classifier.scoringFunctionBased.logPrior.LogPrior
`UNKNOWN`

Constructor Summary
`SeparateLogPrior(double[] vars, double[] classVars, double[] classMus)` Creates a new `SeparateLogPrior` using the class-specific base variances `vars`, the variances `classVars` and the means `classMus` for the class parameters.
`SeparateLogPrior(StringBuffer xml)` Recreates a `SeparateLogPrior` from its XML representation as returned by `toXML()`.

Method Summary
`SeparateLogPrior` | `getNewInstance()` This method returns an empty new instance of the current prior.
`void` | `set(boolean freeParameters, ScoringFunction... funs)` Resets all pre-computed values to their initial values using the `ScoringFunction`s `funs`.
`StringBuffer` | `toXML()` Encodes the prior as an XML representation.
`protected abstract void` | `unset()` Resets all internally pre-computed values, e.g. the hyperparameters for each parameter.

Methods inherited from class de.jstacs.classifier.scoringFunctionBased.logPrior.LogPrior
`addGradientFor, evaluateGradientOfFunction, getInstanceName`

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`

Methods inherited from interface de.jstacs.algorithms.optimization.Function
`evaluateFunction, getDimensionOfScope`

Field Detail

### funs

    protected NormalizableScoringFunction[] funs

  The `ScoringFunction`s using the parameters that shall be penalized

### vars

    protected double[] vars

  The base variances for the parameters of the `ScoringFunction`s of each class, the means of the non-class parameters should be 0

### classVars

    protected double[] classVars

  The variances for the class parameters, as specified by the user

### classMus

    protected double[] classMus

  The means for the class parameters, as specified by the user

### freeParameters

    protected boolean freeParameters

  Indicates, if only free parameters shall be used and hence penalized

Constructor Detail

### SeparateLogPrior

    public SeparateLogPrior(double[] vars,
                            double[] classVars,
                            double[] classMus)

  Creates a new `SeparateLogPrior` using the class-specific base variances `vars`, the variances `classVars` and the means `classMus` for the class parameters.

  Parameters:
    `vars` - the base variances for each class
    `classVars` - the variances for the class parameters
    `classMus` - the means for the class parameters

### SeparateLogPrior

    public SeparateLogPrior(StringBuffer xml)
                     throws NonParsableException

  Recreates a `SeparateLogPrior` from its XML representation as returned by `toXML()`.

  Parameters:
    `xml` - the XML representation
  Throws:
    `NonParsableException` - is thrown if the XML code could not be parsed

Method Detail

### set

    public void set(boolean freeParameters,
                    ScoringFunction... funs)
             throws Exception

  Description copied from class: `LogPrior`
  Resets all pre-computed values to their initial values using the `ScoringFunction`s `funs`.

  Overrides:
    `set` in class `LogPrior`
  Parameters:
    `freeParameters` - if `true`, only the free parameters are used
    `funs` - the `ScoringFunction`s for the prior
  Throws:
    `Exception` - is thrown if the `ScoringFunction`s could not be set

### unset

    protected abstract void unset()

  Resets all internally pre-computed values, e.g. the hyperparameters for each parameter.

### getNewInstance

    public SeparateLogPrior getNewInstance()
                                    throws CloneNotSupportedException

  Description copied from class: `LogPrior`
  This method returns an empty new instance of the current prior. The method works similar to clone, but does not clone `ScoringFunction` s that may be inside the instance. The `ScoringFunction`s must be set by an invocation of the method `LogPrior.set(boolean, ScoringFunction...)`.

  Specified by:
    `getNewInstance` in class `LogPrior`
  Returns:
    a new empty instance of the prior
  Throws:
    `CloneNotSupportedException` - if something went wrong while cloning
  See Also:
    `LogPrior.set(boolean, ScoringFunction...)`

### toXML

    public StringBuffer toXML()

  Description copied from class: `LogPrior`
  Encodes the prior as an XML representation. It does not encode all information, since the method ``LogPrior.set(boolean, ScoringFunction...)` has to be invoked after decoding.

  `
  Specified by:
    `toXML` in interface `Storable`
  Specified by:
    `toXML` in class `LogPrior`
  Returns:
    the XML representation;

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