|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.scoringFunctions.directedGraphicalModels.Parameter
public class Parameter
Class for the parameters of a BayesianNetworkScoringFunction
. Each parameter holds its current value, the symbol and position it is responsible for,
the context of the current symbol. A parameter can either be free or determined by other parameters (on the same simplex).
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 pseudo count 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 parameters 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 parameters of the BayesianNetworkScoringFunction and responsible for symbol
at position position having context context and pseudo count pseudoCount . |
|
Parameter(StringBuffer representation)
Re-creates a parameter from its XML-representation as returned by the toXML() } method. |
Method Summary | |
---|---|
void |
addCount(double count2)
Adds count2 the the counts of this parameter. |
Parameter |
clone()
|
double |
doesApplyFor(Sequence seq)
Returns true if seq fulfills all requirements defined in the context (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 |
getPartialNormalizer()
Returns the partial derivative of the normalization constant with respect to this parameter. |
int |
getPosition()
Returns the position of this parameter as defined in the constructor. |
double |
getPseudoCount()
Returns the pseudo count as given in the constructor. |
double |
getValue()
Returns the current value of this parameter. |
double |
getZ()
Returns the part of the normalization constant of parameters after this parameter in the structure of the network. |
void |
invalidateNormalizers()
Resets all internal normalization constants |
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 pseudo counts and the value to 0 . |
void |
setValue(double value)
Sets the current value of this parameter. |
StringBuffer |
toXML()
This method returns an XML-representation 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 |
---|
protected byte symbol
Alphabet
) this parameter is responsible for.
protected int position
symbol
this parameter is responsible for.
protected int[][] context
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.
protected double count
protected double pseudoCount
Constructor Detail |
---|
public Parameter(int index, byte symbol, int position, double pseudoCount, boolean free)
index
in the list of parameters of the BayesianNetworkScoringFunction
and responsible for symbol
at position position
and pseudo count pseudoCount
.
index
- the index in the list of all parameterssymbol
- the symbol this parameter is responsible forposition
- the position of the symbolpseudoCount
- the pseudo countfree
- indicates if this parameter is a free parameterpublic Parameter(int index, byte symbol, int position, int[][] context, double pseudoCount, boolean free)
index
in the list of parameters of the BayesianNetworkScoringFunction
and responsible for symbol
at position position
having context context
and pseudo count pseudoCount
.
index
- the index in the list of all parameterssymbol
- the symbol this parameter is responsible forposition
- the position of the symbolcontext
- the context of this parameterpseudoCount
- the pseudo countfree
- indicates if this parameter is a free parametercontext
public Parameter(StringBuffer representation) throws NonParsableException
toXML()
} method.
representation
- the XML-code
NonParsableException
- is thrown if the representation could not be parsedMethod Detail |
---|
public Parameter clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public double getPseudoCount()
Parameter(int, byte, int, double, boolean)
,
Parameter(int, byte, int, int[][], double, boolean)
public void reset()
0
.
public int getDepth()
public void print()
System.out
.
public double doesApplyFor(Sequence seq)
seq
fulfills all requirements defined in the context (context
}).
seq
- the sequence
seq
public double getValue()
public void setValue(double value)
value
- the new valuepublic double getExpValue()
Math.exp(getValue())
, which is pre-computed.
public StringBuffer toXML()
Storable
toXML
in interface Storable
public void invalidateNormalizers()
public double getPartialNormalizer() throws Exception
Exception
- thrown if no normalization constants have been pre-computedpublic double getCounts()
public void addCount(double count2)
count2
the the counts of this parameter.
count2
- the additional countspublic boolean isFree()
public int getPosition()
Parameter(int, byte, int, double, boolean)
,
Parameter(int, byte, int, int[][], double, boolean)
public int getIndex()
Parameter(int, byte, int, double, boolean)
,
Parameter(int, byte, int, int[][], double, boolean)
public double getZ()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |