|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.scoringFunctions.AbstractNormalizableScoringFunction
public abstract class AbstractNormalizableScoringFunction
This class is the main part of any ScoreClassifier. It implements
many methods of the interface NormalizableScoringFunction.
| Field Summary | |
|---|---|
protected AlphabetContainer |
alphabets
The AlphabetContainer of this NormalizableScoringFunction
. |
protected int |
length
The length of the modeled sequences. |
protected static Random |
r
This object can be used for drawing initial parameters. |
| Fields inherited from interface de.jstacs.scoringFunctions.ScoringFunction |
|---|
UNKNOWN |
| Constructor Summary | |
|---|---|
AbstractNormalizableScoringFunction(AlphabetContainer alphabets,
int length)
The main constructor. |
|
AbstractNormalizableScoringFunction(StringBuffer xml)
This is the constructor for Storable. |
|
| Method Summary | |
|---|---|
AbstractNormalizableScoringFunction |
clone()
Creates a clone (deep copy) of the current ScoringFunction
instance. |
protected abstract void |
fromXML(StringBuffer xml)
This method is called in the constructor for the Storable
interface to create a scoring function from a StringBuffer. |
AlphabetContainer |
getAlphabetContainer()
Returns the AlphabetContainer for this ScoringFunction. |
double |
getInitialClassParam(double classProb)
Returns the initial class parameter for the class this ScoringFunction is responsible for, based on the class
probability classProb. |
int |
getLength()
Returns the length of this ScoringFunction, i.e. the length of
the Sequences this ScoringFunction can handle. |
double |
getLogScore(Sequence seq)
Returns the logarithmic score for a given Sequence. |
double |
getLogScoreAndPartialDerivation(Sequence seq,
IntList indices,
DoubleList partialDer)
Returns the logarithmic score for a Sequence seq and
fills lists with the indices and the partial derivations. |
int |
getNumberOfRecommendedStarts()
This method returns the number of recommended optimization starts. |
static int |
getNumberOfStarts(ScoringFunction[] score)
Returns the number of recommended starts in a numerical optimization. |
boolean |
isNormalized()
This method indicates whether the implemented score is already normalized to 1 or not. |
static boolean |
isNormalized(NormalizableScoringFunction... function)
This method checks whether all given NormalizableScoringFunctions
are normalized. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.jstacs.scoringFunctions.NormalizableScoringFunction |
|---|
addGradientOfLogPriorTerm, getEss, getLogNormalizationConstant, getLogPartialNormalizationConstant, getLogPriorTerm, getSizeOfEventSpaceForRandomVariablesOfParameter |
| Methods inherited from interface de.jstacs.scoringFunctions.ScoringFunction |
|---|
getCurrentParameterValues, getInstanceName, getLogScore, getLogScoreAndPartialDerivation, getNumberOfParameters, initializeFunction, initializeFunctionRandomly, isInitialized, setParameters |
| Methods inherited from interface de.jstacs.Storable |
|---|
toXML |
| Field Detail |
|---|
protected static final Random r
ScoringFunction.getCurrentParameterValues()protected AlphabetContainer alphabets
AlphabetContainer of this NormalizableScoringFunction
.
protected int length
| Constructor Detail |
|---|
public AbstractNormalizableScoringFunction(AlphabetContainer alphabets,
int length)
throws IllegalArgumentException
alphabets - the AlphabetContainer of this ScoringFunctionlength - the length of this ScoringFunction, i.e. the length of
the modeled sequences
IllegalArgumentException - if the length is negative or does not match with AlphabetContainer.getPossibleLength()
public AbstractNormalizableScoringFunction(StringBuffer xml)
throws NonParsableException
Storable. Creates a new
AbstractNormalizableScoringFunction out of a StringBuffer
.
xml - the XML representation as StringBuffer
NonParsableException - if the XML representation could not be parsed| Method Detail |
|---|
public static final int getNumberOfStarts(ScoringFunction[] score)
score - the scoring functions
ScoringFunction.getNumberOfRecommendedStarts()
public AbstractNormalizableScoringFunction clone()
throws CloneNotSupportedException
ScoringFunctionScoringFunction
instance.
clone in interface ScoringFunctionclone in class ObjectScoringFunction
CloneNotSupportedException - if something went wrong while cloning the
ScoringFunction
protected abstract void fromXML(StringBuffer xml)
throws NonParsableException
Storable
interface to create a scoring function from a StringBuffer.
xml - the XML representation as StringBuffer
NonParsableException - if the StringBuffer could not be parsedAbstractNormalizableScoringFunction(StringBuffer)public final AlphabetContainer getAlphabetContainer()
ScoringFunctionAlphabetContainer for this ScoringFunction.
Only Sequences with a comparable AlphabetContainer can be
modeled.
getAlphabetContainer in interface ScoringFunctionAlphabetContainerpublic int getLength()
ScoringFunctionScoringFunction, i.e. the length of
the Sequences this ScoringFunction can handle. For
homogeneous ScoringFunctions, i.e. ScoringFunctions that
support Sequences of different lengths, the method should return
0.
getLength in interface ScoringFunctionScoringFunctionpublic final double getLogScore(Sequence seq)
Sequence.
getLogScore in interface ScoringFunctionseq - the Sequence
Sequence
public final double getLogScoreAndPartialDerivation(Sequence seq,
IntList indices,
DoubleList partialDer)
ScoringFunctionSequence seq and
fills lists with the indices and the partial derivations.
getLogScoreAndPartialDerivation in interface ScoringFunctionseq - the Sequenceindices - an IntList of indices, after method invocation the
list should contain the indices i where
is not zeropartialDer - a DoubleList of partial derivations, after method
invocation the list should contain the corresponding
that are not zero
Sequencepublic int getNumberOfRecommendedStarts()
ScoringFunction
getNumberOfRecommendedStarts in interface ScoringFunctionpublic boolean isNormalized()
NormalizableScoringFunctionfalse.
isNormalized in interface NormalizableScoringFunctiontrue if the implemented score is already normalized
to 1, false otherwisepublic static boolean isNormalized(NormalizableScoringFunction... function)
NormalizableScoringFunctions
are normalized.
function - the NormalizableScoringFunctions to be checked
true if all NormalizableScoringFunctions are
already normalized, otherwise falseNormalizableScoringFunction.isNormalized()public double getInitialClassParam(double classProb)
ScoringFunctionScoringFunction is responsible for, based on the class
probability classProb.
getInitialClassParam in interface NormalizableScoringFunctiongetInitialClassParam in interface ScoringFunctionclassProb - the class probability
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||