|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction
de.jstacs.scoringFunctions.mix.MixtureScoringFunction
public class MixtureScoringFunction
This class implements a real mixture model.
Field Summary |
---|
Fields inherited from class de.jstacs.scoringFunctions.mix.AbstractMixtureScoringFunction |
---|
componentScore, dList, freeParams, function, hiddenParameter, hiddenPotential, iList, isNormalized, logGammaSum, logHiddenNorm, logHiddenPotential, norm, optimizeHidden, paramRef, partNorm |
Fields inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
---|
alphabets, length, r |
Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction |
---|
UNKNOWN |
Constructor Summary | |
---|---|
MixtureScoringFunction(int starts,
boolean plugIn,
NormalizableScoringFunction... component)
This constructor creates a new MixtureScoringFunction . |
|
MixtureScoringFunction(StringBuffer xml)
This is the constructor for the interface Storable . |
Method Summary | |
---|---|
protected void |
fillComponentScores(Sequence seq,
int start)
Fills the internal array AbstractMixtureScoringFunction.componentScore with the logarithmic
scores of the components given a Sequence . |
double |
getEss()
Returns the equivalent sample size (ess) of this model, i.e. the equivalent sample size for the class or component that is represented by this model. |
double |
getHyperparameterForHiddenParameter(int index)
This method returns the hyperparameter for the hidden parameter with index index . |
String |
getInstanceName()
Returns a short instance name. |
double |
getLogScoreAndPartialDerivation(Sequence seq,
int start,
IntList indices,
DoubleList partialDer)
Returns the logarithmic score for a Sequence beginning at
position start in the Sequence and fills lists with
the indices and the partial derivations. |
protected double |
getNormalizationConstantForComponent(int i)
Computes the normalization constant for the component i . |
double |
getPartialNormalizationConstant(int parameterIndex)
Returns the partial normalization constant for the parameter with index parameterIndex . |
protected void |
initializeUsingPlugIn(int index,
boolean freeParams,
Sample[] data,
double[][] weights)
This method initializes the functions using the data in some way. |
String |
toString()
|
Methods inherited from class de.jstacs.scoringFunctions.AbstractNormalizableScoringFunction |
---|
getAlphabetContainer, getInitialClassParam, getLength, getLogScore, getLogScoreAndPartialDerivation, isNormalized |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MixtureScoringFunction(int starts, boolean plugIn, NormalizableScoringFunction... component) throws CloneNotSupportedException
MixtureScoringFunction
.
starts
- the number of starts that should be done in an optimizationplugIn
- indicates whether the initial parameters for an optimization
should be related to the data or randomly drawncomponent
- the ScoringFunction
s
CloneNotSupportedException
- if an element of component
could not be clonedpublic MixtureScoringFunction(StringBuffer xml) throws NonParsableException
Storable
.
Creates a new MixtureScoringFunction
out of a
StringBuffer
.
xml
- the XML representation as StringBuffer
NonParsableException
- if the XML representation could not be parsedMethod Detail |
---|
protected double getNormalizationConstantForComponent(int i)
AbstractMixtureScoringFunction
i
.
getNormalizationConstantForComponent
in class AbstractMixtureScoringFunction
i
- the index of the component
public double getPartialNormalizationConstant(int parameterIndex) throws Exception
NormalizableScoringFunction
parameterIndex
. This is the partial derivation of the
normalization constant for the parameter with index
parameterIndex
, in LaTex notation:
\frac{\partial Z(\lambda)}{\partial \lambda_{index}}
.
parameterIndex
- the index of the parameter
Exception
- if something went wrong with the normalizationNormalizableScoringFunction.getNormalizationConstant()
public double getHyperparameterForHiddenParameter(int index)
AbstractMixtureScoringFunction
index
.
getHyperparameterForHiddenParameter
in class AbstractMixtureScoringFunction
index
- the index of the hidden parameter
public double getEss()
NormalizableScoringFunction
protected void initializeUsingPlugIn(int index, boolean freeParams, Sample[] data, double[][] weights) throws Exception
AbstractMixtureScoringFunction
initializeUsingPlugIn
in class AbstractMixtureScoringFunction
index
- the class indexfreeParams
- if true, the (reduced) parameterization is useddata
- the dataweights
- the weights for the data
- Throws:
Exception
- if the initialization could not be done- See Also:
ScoringFunction.initializeFunction(int,
boolean, Sample[], double[][])
public String getInstanceName()
ScoringFunction
protected void fillComponentScores(Sequence seq, int start)
AbstractMixtureScoringFunction
AbstractMixtureScoringFunction.componentScore
with the logarithmic
scores of the components given a Sequence
.
fillComponentScores
in class AbstractMixtureScoringFunction
seq
- the sequencestart
- the start position in seq
public double getLogScoreAndPartialDerivation(Sequence seq, int start, IntList indices, DoubleList partialDer)
ScoringFunction
Sequence
beginning at
position start
in the Sequence
and fills lists with
the indices and the partial derivations.
seq
- the Sequence
start
- the start position in the Sequence
indices
- an IntList
of indices, after method invocation the
list should contain the indices i where
\frac{\partial \log
score(seq)}{\partial \lambda_i}
is not zeropartialDer
- a DoubleList
of partial derivations, after method
invocation the list should contain the corresponding
\frac{\partial \log
score(seq)}{\partial \lambda_i}
Sequence
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |