public abstract class AbstractDifferentiableSequenceScore extends Object implements DifferentiableSequenceScore
ScoreClassifier. It implements
many methods of the interface DifferentiableSequenceScore.| Modifier and Type | Field and Description |
|---|---|
protected AlphabetContainer |
alphabets
The
AlphabetContainer of this AbstractDifferentiableSequenceScore
. |
protected int |
length
The length of the modeled sequences.
|
protected static Random |
r
This object can be used for drawing initial parameters.
|
UNKNOWN| Constructor and Description |
|---|
AbstractDifferentiableSequenceScore(AlphabetContainer alphabets,
int length)
The main constructor.
|
AbstractDifferentiableSequenceScore(StringBuffer xml)
This is the constructor for
Storable. |
| Modifier and Type | Method and Description |
|---|---|
AbstractDifferentiableSequenceScore |
clone()
Creates a clone (deep copy) of the current
DifferentiableSequenceScore
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 container of alphabets that were used when constructing the instance.
|
ResultSet |
getCharacteristics()
Returns some information characterizing or describing the current
instance.
|
double |
getInitialClassParam(double classProb)
Returns the initial class parameter for the class this
DifferentiableSequenceScore is responsible for, based on the class
probability classProb. |
int |
getLength()
Returns the length of sequences this instance can score.
|
double |
getLogScoreAndPartialDerivation(Sequence seq,
int startpos,
int endpos,
IntList indices,
DoubleList partialDer)
|
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. |
double[] |
getLogScoreFor(DataSet data)
This method computes the logarithm of the scores of all sequences
in the given data set.
|
void |
getLogScoreFor(DataSet data,
double[] res)
This method computes and stores the logarithm of the scores for
any sequence in the data set in the given
double-array. |
double |
getLogScoreFor(Sequence seq)
Returns the logarithmic score for the
Sequence seq. |
double |
getLogScoreFor(Sequence seq,
int startpos,
int endpos)
|
int |
getNumberOfRecommendedStarts()
This method returns the number of recommended optimization starts.
|
static int |
getNumberOfStarts(DifferentiableSequenceScore[] score)
Returns the number of recommended starts in a numerical optimization.
|
NumericalResultSet |
getNumericalCharacteristics()
Returns the subset of numerical values that are also returned by
SequenceScore.getCharacteristics(). |
String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCurrentParameterValues, getLogScoreAndPartialDerivation, getNumberOfParameters, initializeFunction, initializeFunctionRandomly, setParametersgetInstanceName, getLogScoreFor, isInitialized, toStringprotected static final Random r
protected AlphabetContainer alphabets
AlphabetContainer of this AbstractDifferentiableSequenceScore
.protected int length
public AbstractDifferentiableSequenceScore(AlphabetContainer alphabets, int length) throws IllegalArgumentException
alphabets - the AlphabetContainer of this DifferentiableSequenceScorelength - the length of this DifferentiableSequenceScore, i.e. the length of
the modeled sequencesIllegalArgumentException - if the length is negative or does not match with AlphabetContainer.getPossibleLength()public AbstractDifferentiableSequenceScore(StringBuffer xml) throws NonParsableException
Storable. Creates a new
AbstractDifferentiableSequenceScore out of a StringBuffer
.xml - the XML representation as StringBufferNonParsableException - if the XML representation could not be parsedpublic static final int getNumberOfStarts(DifferentiableSequenceScore[] score)
score - the scoring functionsDifferentiableSequenceScore.getNumberOfRecommendedStarts()public AbstractDifferentiableSequenceScore clone() throws CloneNotSupportedException
DifferentiableSequenceScoreDifferentiableSequenceScore
instance.clone in interface DifferentiableSequenceScoreclone in interface SequenceScoreclone in class ObjectDifferentiableSequenceScoreCloneNotSupportedException - if something went wrong while cloning the
DifferentiableSequenceScoreprotected abstract void fromXML(StringBuffer xml) throws NonParsableException
Storable
interface to create a scoring function from a StringBuffer.xml - the XML representation as StringBufferNonParsableException - if the StringBuffer could not be parsedAbstractDifferentiableSequenceScore(StringBuffer)public final AlphabetContainer getAlphabetContainer()
SequenceScoregetAlphabetContainer in interface SequenceScorepublic int getLength()
SequenceScoregetLength in interface SequenceScorepublic final double getLogScoreFor(Sequence seq)
SequenceScoreSequence seq.getLogScoreFor in interface SequenceScoreseq - the sequencepublic double getLogScoreFor(Sequence seq, int startpos, int endpos) throws WrongLengthException
SequenceScoregetLogScoreFor in interface SequenceScoreseq - the Sequencestartpos - the start position in the Sequenceendpos - the end position (inclusive) in the SequenceSequenceWrongLengthExceptionpublic final double getLogScoreAndPartialDerivation(Sequence seq, IntList indices, DoubleList partialDer)
DifferentiableSequenceScoreSequence seq and
fills lists with the indices and the partial derivations.getLogScoreAndPartialDerivation in interface DifferentiableSequenceScoreseq - 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 zeroSequencepublic double getLogScoreAndPartialDerivation(Sequence seq, int startpos, int endpos, IntList indices, DoubleList partialDer) throws WrongLengthException
DifferentiableSequenceScoreSequence beginning at
position start in the Sequence and fills lists with
the indices and the partial derivations.getLogScoreAndPartialDerivation in interface DifferentiableSequenceScoreseq - the Sequencestartpos - the start position in the Sequenceendpos - the end position (inclusive) in 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 zeroSequenceWrongLengthExceptionpublic int getNumberOfRecommendedStarts()
DifferentiableSequenceScoregetNumberOfRecommendedStarts in interface DifferentiableSequenceScorepublic double getInitialClassParam(double classProb)
DifferentiableSequenceScoreDifferentiableSequenceScore is responsible for, based on the class
probability classProb.getInitialClassParam in interface DifferentiableSequenceScoreclassProb - the class probabilitypublic double[] getLogScoreFor(DataSet data) throws Exception
SequenceScoreSequenceScore.getLogScoreFor(Sequence).getLogScoreFor in interface SequenceScoredata - the data set of sequencesException - if something went wrongSequenceScore.getLogScoreFor(Sequence)public void getLogScoreFor(DataSet data, double[] res) throws Exception
SequenceScoredouble-array.
SequenceScore.getLogScoreFor(Sequence).getLogScoreFor in interface SequenceScoredata - the data set of sequencesres - the array for the results, has to have length
data.getNumberOfElements() (which returns the
number of sequences in the data set)Exception - if something went wrongSequenceScore.getLogScoreFor(Sequence),
SequenceScore.getLogScoreFor(DataSet)public ResultSet getCharacteristics() throws Exception
SequenceScoreStorableResult.getCharacteristics in interface SequenceScoreException - if some of the characteristics could not be definedStorableResultpublic NumericalResultSet getNumericalCharacteristics() throws Exception
SequenceScoreSequenceScore.getCharacteristics().getNumericalCharacteristics in interface SequenceScoreException - if some of the characteristics could not be defined