public class BNDiffSMParameter extends Object implements Storable, Cloneable
BayesianNetworkDiffSM
. 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).Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
BNDiffSMParameter(int index,
byte symbol,
int position,
double pseudoCount,
boolean free)
Creates a new
BNDiffSMParameter , that is BNDiffSMParameter no
index in the list of BNDiffSMParameter s of the
BayesianNetworkDiffSM and responsible for
symbol at position position and pseudo count
pseudoCount . |
BNDiffSMParameter(int index,
byte symbol,
int position,
int[][] context,
double pseudoCount,
boolean free)
Creates a new
BNDiffSMParameter , that is BNDiffSMParameter no
index in the list of BNDiffSMParameter s of the
BayesianNetworkDiffSM and responsible for
symbol at position position having context
context and pseudocount pseudoCount . |
BNDiffSMParameter(StringBuffer representation)
The standard constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
void |
addCount(double count2)
Adds
count2 to the counts of this parameter. |
BNDiffSMParameter |
clone() |
double |
doesApplyFor(Sequence seq)
|
double |
getCounts()
Returns the current counts for this parameter.
|
int |
getDepth()
Returns the depth of the tree, i.e.
|
double |
getExpValue()
Returns
Math.exp( , 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. |
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
public BNDiffSMParameter(int index, byte symbol, int position, double pseudoCount, boolean free)
BNDiffSMParameter
, that is BNDiffSMParameter
no
index
in the list of BNDiffSMParameter
s of the
BayesianNetworkDiffSM
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 pseudocountfree
- indicates if this parameter is a free parameterpublic BNDiffSMParameter(int index, byte symbol, int position, int[][] context, double pseudoCount, boolean free)
BNDiffSMParameter
, that is BNDiffSMParameter
no
index
in the list of BNDiffSMParameter
s of the
BayesianNetworkDiffSM
and responsible for
symbol
at position position
having context
context
and pseudocount 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 pseudocountfree
- indicates if this parameter is a free parameterpublic BNDiffSMParameter(StringBuffer representation) throws NonParsableException
Storable
.
Re-creates a parameter from its XML-representation as returned by the
method toXML()
.representation
- the XML code as StringBuffer
NonParsableException
- if the StringBuffer
representation
could
not be parsedpublic BNDiffSMParameter clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public double getPseudoCount()
BNDiffSMParameter(int, byte, int, double, boolean)
,
BNDiffSMParameter(int, byte, int, int[][], double, boolean)
public void reset()
0
.public int getDepth()
public void print()
System.out
.public double doesApplyFor(Sequence seq)
seq
- the sequencetrue
if this parameter is responsible for
seq
, false
otherwisepublic double getValue()
public void setValue(double value)
value
- the new value to be setpublic double getExpValue()
Math.exp(getValue()
)
, which is pre-computed.public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.public void invalidateNormalizers()
null
.public double getLogPartialNormalizer() throws Exception
Exception
- if no normalization constants have been pre-computedpublic double getCounts()
public void addCount(double count2)
count2
to the counts of this parameter.count2
- the counts to be addedpublic boolean isFree()
true
if the parameter is free, false
otherwisepublic int getPosition()
BNDiffSMParameter(int, byte, int, double, boolean)
,
BNDiffSMParameter(int, byte, int, int[][], double, boolean)
public int getIndex()
BNDiffSMParameter(int, byte, int, double, boolean)
,
BNDiffSMParameter(int, byte, int, int[][], double, boolean)
public double getLogZ()
public double getLogT()