|
||||||||||
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, function, hiddenParameter, hiddenPotential, iList, isNormalized, logGammaSum, logHiddenNorm, logHiddenPotential, norm, optimizeHidden, paramRef, partNorm, plugIn |
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 mixture. |
|
MixtureScoringFunction(StringBuffer xml)
This is the constructor for Storable . |
Method Summary | |
---|---|
protected void |
fillComponentScores(Sequence seq,
int start)
Fills the internal array componentScore with the log scores of the components. |
double |
getEss()
Returns the equivalent sample size 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 log score for the sequence and fills the list 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 function 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
starts
- the number of starts the should be done in an optimizationplugIn
- whether the initial parameters for an optimization should be related to the data or randomly drawncomponent
- the ScoringFunctions
CloneNotSupportedException
public MixtureScoringFunction(StringBuffer xml) throws NonParsableException
Storable
.
xml
- the xml representation
NonParsableException
- if the representation could not be parsed.Method 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
\frac{\partial Z(\lambda)}{\partial \lambda_{index}}
.
parameterIndex
- the index of the parameter
Exception
- if something went wrong with the Normalizationpublic double getHyperparameterForHiddenParameter(int index)
AbstractMixtureScoringFunction
index
.
getHyperparameterForHiddenParameter
in class AbstractMixtureScoringFunction
index
- the index
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
- 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
componentScore
with the log scores of the components.
fillComponentScores
in class AbstractMixtureScoringFunction
seq
- the sequencestart
- the start positionpublic double getLogScoreAndPartialDerivation(Sequence seq, int start, IntList indices, DoubleList partialDer)
ScoringFunction
seq
- the sequencestart
- the startposition in the sequenceindices
- after method invocation the list should contain the indices i where \frac{\partial \log
score(seq)}{\partial \lambda_i} is not zeropartialDer
- after method invocation the list should contain the corresponding \frac{\partial \log
score(seq)}{\partial \lambda_i}
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |