|
||||||||||
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 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 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 log score for the sequence |
double |
getLogScoreAndPartialDerivation(Sequence seq,
IntList indices,
DoubleList partialDer)
Returns the log score for the sequence and fills the list with the indices and the partial derivations. |
int |
getNumberOfRecommendedStarts()
This method return the number of recommended optimization starts. |
boolean |
isNormalized()
This method returns whether the implemented score is already normalized to 1. |
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, getLogPriorTerm, getNormalizationConstant, getPartialNormalizationConstant, 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
NormalizableScoringFunction
protected int length
Constructor Detail |
---|
public AbstractNormalizableScoringFunction(AlphabetContainer alphabets, int length)
alphabets
- the AlphabetContainer of this ScoringFunctionlength
- the length of this ScoringFunctionpublic AbstractNormalizableScoringFunction(StringBuffer xml) throws NonParsableException
Storable
.
xml
- the xml representation
NonParsableException
- if the representation could not be parsed.Method Detail |
---|
public AbstractNormalizableScoringFunction clone() throws CloneNotSupportedException
ScoringFunction
ScoringFunction
instance.
clone
in interface ScoringFunction
clone
in class Object
CloneNotSupportedException
protected abstract void fromXML(StringBuffer xml) throws NonParsableException
xml
- the XML representation
NonParsableException
- if the StringBuffer could not be parsed.public final AlphabetContainer getAlphabetContainer()
ScoringFunction
AlphabetContainer
for this ScoringFunction
.
Only Sequence
s with a comparable AlphabetContainer can be modeled.
getAlphabetContainer
in interface ScoringFunction
public int getLength()
ScoringFunction
ScoringFunction
. i.e. the length of the Sequence
s this ScoringFunction
can handle. For homogeneous ScoringFunction
, i.e.
ScoringFunction
s that support Sequence
s of different lengths, should return 0
.
getLength
in interface ScoringFunction
public final double getLogScore(Sequence seq)
getLogScore
in interface ScoringFunction
seq
- the sequence
public final double getLogScoreAndPartialDerivation(Sequence seq, IntList indices, DoubleList partialDer)
ScoringFunction
getLogScoreAndPartialDerivation
in interface ScoringFunction
seq
- 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 int getNumberOfRecommendedStarts()
ScoringFunction
getNumberOfRecommendedStarts
in interface ScoringFunction
public boolean isNormalized()
NormalizableScoringFunction
false
.
isNormalized
in interface NormalizableScoringFunction
public static boolean isNormalized(NormalizableScoringFunction... function)
function
- the NormalizableScoringFunctions to be checked
true
if all NormalizableScoringFunctions are already normalized, otherwise false
NormalizableScoringFunction.isNormalized()
public double getInitialClassParam(double classProb)
ScoringFunction
ScoringFunction
is responsible for, based on the 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 |