|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.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 Sequence s 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 NormalizableScoringFunction s
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 ScoringFunction
length
- 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 parsedMethod Detail |
---|
public static final int getNumberOfStarts(ScoringFunction[] score)
score
- the scoring functions
ScoringFunction.getNumberOfRecommendedStarts()
public AbstractNormalizableScoringFunction clone() throws CloneNotSupportedException
ScoringFunction
ScoringFunction
instance.
clone
in interface ScoringFunction
clone
in class Object
ScoringFunction
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()
ScoringFunction
AlphabetContainer
for this ScoringFunction
.
Only Sequence
s with a comparable AlphabetContainer
can be
modeled.
getAlphabetContainer
in interface ScoringFunction
AlphabetContainer
public int getLength()
ScoringFunction
ScoringFunction
, i.e. the length of
the Sequence
s this ScoringFunction
can handle. For
homogeneous ScoringFunction
s, i.e. ScoringFunction
s that
support Sequence
s of different lengths, the method should return
0
.
getLength
in interface ScoringFunction
ScoringFunction
public final double getLogScore(Sequence seq)
Sequence
.
getLogScore
in interface ScoringFunction
seq
- the Sequence
Sequence
public final double getLogScoreAndPartialDerivation(Sequence seq, IntList indices, DoubleList partialDer)
ScoringFunction
Sequence
seq
and
fills lists with the indices and the partial derivations.
getLogScoreAndPartialDerivation
in interface ScoringFunction
seq
- the Sequence
indices
- 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
Sequence
public int getNumberOfRecommendedStarts()
ScoringFunction
getNumberOfRecommendedStarts
in interface ScoringFunction
public boolean isNormalized()
NormalizableScoringFunction
false
.
isNormalized
in interface NormalizableScoringFunction
true
if the implemented score is already normalized
to 1, false
otherwisepublic static boolean isNormalized(NormalizableScoringFunction... function)
NormalizableScoringFunction
s
are normalized.
function
- the NormalizableScoringFunction
s to be checked
true
if all NormalizableScoringFunction
s are
already normalized, otherwise false
NormalizableScoringFunction.isNormalized()
public double getInitialClassParam(double classProb)
ScoringFunction
ScoringFunction
is responsible for, based on the class
probability classProb
.
getInitialClassParam
in interface NormalizableScoringFunction
getInitialClassParam
in interface ScoringFunction
classProb
- the class probability
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |