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.scoringFunctions.directedGraphicalModels
Class Parameter

    java.lang.Object
      de.jstacs.scoringFunctions.directedGraphicalModels.Parameter

All Implemented Interfaces:
  Storable, Cloneable

    public class Parameter

extends Object
implements Storable, Cloneable

Class for the parameters of a `BayesianNetworkScoringFunction`. Each parameter holds its current value, the symbol and position it is responsible for and the context of the current symbol. A parameter can either be free or determined by other parameters (on the same simplex).

Author:
  Jan Grau

Field Summary
`protected int[][]` | `context` The context of this parameter.
`protected double` | `count` The counts for this parameter.
`protected int` | `position` The position of `symbol` this parameter is responsible for.
`protected double` | `pseudoCount` The pseudocount for this parameter.
`protected byte` | `symbol` The symbol (out of some `Alphabet`) this parameter is responsible for.

Constructor Summary
`Parameter(int index, byte symbol, int position, double pseudoCount, boolean free)` Creates a new `Parameter`, that is `Parameter` no `index` in the list of `Parameter`s of the `BayesianNetworkScoringFunction` and responsible for `symbol` at position `position` and pseudo count `pseudoCount`.
`Parameter(int index, byte symbol, int position, int[][] context, double pseudoCount, boolean free)` Creates a new `Parameter`, that is `Parameter` no `index` in the list of `Parameter`s of the `BayesianNetworkScoringFunction` and responsible for `symbol` at position `position` having context `context` and pseudocount `pseudoCount`.
`Parameter(StringBuffer representation)` The standard constructor for the interface `Storable`.

Method Summary
`void` | `addCount(double count2)` Adds `count2` to the counts of this parameter.
`Parameter` | `clone()`
`double` | `doesApplyFor(Sequence seq)` Indicates if the `Sequence` `seq` fulfills all requirements defined in the `context`.
`double` | `getCounts()` Returns the current counts for this parameter.
`int` | `getDepth()` Returns the depth of the tree, i.e. the number of parents of this parameter.
`double` | `getExpValue()` Returns `Math.exp(`getValue()`)`, which is pre-computed.
`int` | `getIndex()` Returns the index of this parameter as defined in the constructor.
`double` | `getLogPartialNormalizer()` Returns the partial derivative of the normalization constant with respect to this parameter.
`double` | `getLogT()` Returns the part of the normalization constant of parameters before this parameter in the structure of the network.
`double` | `getLogZ()` Returns the part of the normalization constant of parameters after this parameter in the structure of the network.
`int` | `getPosition()` Returns the position of the symbol this parameter is responsible for as defined in the constructor.
`double` | `getPseudoCount()` Returns the pseudocount as given in the constructor.
`double` | `getValue()` Returns the current value of this parameter.
`void` | `invalidateNormalizers()` Resets all internal normalization constants to `null`.
`boolean` | `isFree()` Indicates if this parameter is free.
`void` | `print()` Prints the counts and the value of this parameter to `System.out`.
`void` | `reset()` Resets the counts to the pseudocounts and the value to `0`.
`void` | `setValue(double value)` Sets the current value of this parameter.
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### symbol

    protected byte symbol

  The symbol (out of some `Alphabet`) this parameter is responsible for.

### position

    protected int position

  The position of `symbol` this parameter is responsible for.

### context

    protected int[][] context

  The context of this parameter. The length `context.length` is equal to the number of parents, `context[i]` holds the information for parent no `i`, `context[i][0]` holds the position of parent `i`, `context[i][1]` ,... hold the possible configurations of parent `i` in the context. Normally, only `context[i][1]` exists, i.e. only one configuration is allowed in the context.

### count

    protected double count

  The counts for this parameter. Used for determination of plug-in parameters.

### pseudoCount

    protected double pseudoCount

  The pseudocount for this parameter. Used for determination of plug-in parameters.

Constructor Detail

### Parameter

    public Parameter(int index,
                     byte symbol,
                     int position,
                     double pseudoCount,
                     boolean free)

  Creates a new `Parameter`, that is `Parameter` no `index` in the list of `Parameter`s of the `BayesianNetworkScoringFunction` and responsible for `symbol` at position `position` and pseudo count `pseudoCount`.

  Parameters:
    `index` - the index in the list of all parameters
    `symbol` - the symbol this parameter is responsible for
    `position` - the position of the symbol
    `pseudoCount` - the pseudocount
    `free` - indicates if this parameter is a free parameter

### Parameter

    public Parameter(int index,
                     byte symbol,
                     int position,
                     int[][] context,
                     double pseudoCount,
                     boolean free)

  Creates a new `Parameter`, that is `Parameter` no `index` in the list of `Parameter`s of the `BayesianNetworkScoringFunction` and responsible for `symbol` at position `position` having context `context` and pseudocount `pseudoCount`.

  Parameters:
    `index` - the index in the list of all parameters
    `symbol` - the symbol this parameter is responsible for
    `position` - the position of the symbol
    `context` - the context of this parameter
    `pseudoCount` - the pseudocount
    `free` - indicates if this parameter is a free parameter

### Parameter

    public Parameter(StringBuffer representation)
              throws NonParsableException

  The standard constructor for the interface `Storable`. Re-creates a parameter from its XML-representation as returned by the method `toXML()`.

  Parameters:
    `representation` - the XML code as `StringBuffer`
  Throws:
    `NonParsableException` - if the `StringBuffer` `representation` could not be parsed

Method Detail

### clone

    public Parameter clone()
                    throws CloneNotSupportedException

  Overrides:
    `clone` in class `Object`
  Throws:
    `CloneNotSupportedException`

### getPseudoCount

    public double getPseudoCount()

  Returns the pseudocount as given in the constructor.

  Returns:
    the pseudocount
  See Also:
    `Parameter(int, byte, int, double, boolean)`, `Parameter(int, byte, int, int[][], double, boolean)`

### reset

    public void reset()

  Resets the counts to the pseudocounts and the value to `0`.

### getDepth

    public int getDepth()

  Returns the depth of the tree, i.e. the number of parents of this parameter.

  Returns:
    the depth of the tree

### print

    public void print()

  Prints the counts and the value of this parameter to `System.out`.

### doesApplyFor

    public double doesApplyFor(Sequence seq)

  Indicates if the `Sequence` `seq` fulfills all requirements defined in the `context`.

  Parameters:
    `seq` - the sequence
  Returns:
    `true` if this parameter is responsible for `seq`, `false` otherwise

### getValue

    public double getValue()

  Returns the current value of this parameter.

  Returns:
    the current value

### setValue

    public void setValue(double value)

  Sets the current value of this parameter.

  Parameters:
    `value` - the new value to be set

### getExpValue

    public double getExpValue()

  Returns `Math.exp(`getValue()`)`, which is pre-computed.

  Returns:
    the exponential value of this parameter

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` of an instance of the implementing class.

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

### invalidateNormalizers

    public void invalidateNormalizers()

  Resets all internal normalization constants to `null`.

### getLogPartialNormalizer

    public double getLogPartialNormalizer()
                                   throws Exception

  Returns the partial derivative of the normalization constant with respect to this parameter.

  Returns:
    the partial derivative
  Throws:
    `Exception` - if no normalization constants have been pre-computed

### getCounts

    public double getCounts()

  Returns the current counts for this parameter.

  Returns:
    the current counts

### addCount

    public void addCount(double count2)

  Adds `count2` to the counts of this parameter.

  Parameters:
    `count2` - the counts to be added

### isFree

    public boolean isFree()

  Indicates if this parameter is free.

  Returns:
    `true` if the parameter is free, `false` otherwise

### getPosition

    public int getPosition()

  Returns the position of the symbol this parameter is responsible for as defined in the constructor.

  Returns:
    the position of this parameter this parameter is responsible for
  See Also:
    `Parameter(int, byte, int, double, boolean)`, `Parameter(int, byte, int, int[][], double, boolean)`

### getIndex

    public int getIndex()

  Returns the index of this parameter as defined in the constructor.

  Returns:
    the index of this parameter in the list of all parameters
  See Also:
    `Parameter(int, byte, int, double, boolean)`, `Parameter(int, byte, int, int[][], double, boolean)`

### getLogZ

    public double getLogZ()

  Returns the part of the normalization constant of parameters after this parameter in the structure of the network.

  Returns:
    the normalization constant

### getLogT

    public double getLogT()

  Returns the part of the normalization constant of parameters before this parameter in the structure of the network.

  Returns:
    the normalization constant

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