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, wait
getCurrentParameterValues, getLogScoreAndPartialDerivation, getNumberOfParameters, initializeFunction, initializeFunctionRandomly, setParameters
getInstanceName, getLogScoreFor, isInitialized, toString
protected 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 DifferentiableSequenceScore
length
- 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 StringBuffer
NonParsableException
- if the XML representation could not be parsedpublic static final int getNumberOfStarts(DifferentiableSequenceScore[] score)
score
- the scoring functionsDifferentiableSequenceScore.getNumberOfRecommendedStarts()
public AbstractDifferentiableSequenceScore clone() throws CloneNotSupportedException
DifferentiableSequenceScore
DifferentiableSequenceScore
instance.clone
in interface DifferentiableSequenceScore
clone
in interface SequenceScore
clone
in class Object
DifferentiableSequenceScore
CloneNotSupportedException
- if something went wrong while cloning the
DifferentiableSequenceScore
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 parsedAbstractDifferentiableSequenceScore(StringBuffer)
public final AlphabetContainer getAlphabetContainer()
SequenceScore
getAlphabetContainer
in interface SequenceScore
public int getLength()
SequenceScore
getLength
in interface SequenceScore
public final double getLogScoreFor(Sequence seq)
SequenceScore
Sequence
seq
.getLogScoreFor
in interface SequenceScore
seq
- the sequencepublic double getLogScoreFor(Sequence seq, int startpos, int endpos) throws WrongLengthException
SequenceScore
getLogScoreFor
in interface SequenceScore
seq
- the Sequence
startpos
- the start position in the Sequence
endpos
- the end position (inclusive) in the Sequence
Sequence
WrongLengthException
public final double getLogScoreAndPartialDerivation(Sequence seq, IntList indices, DoubleList partialDer)
DifferentiableSequenceScore
Sequence
seq
and
fills lists with the indices and the partial derivations.getLogScoreAndPartialDerivation
in interface DifferentiableSequenceScore
seq
- the Sequence
indices
- an IntList
of indices, after method invocation the
list should contain the indices i
where
partialDer
- a DoubleList
of partial derivations, after method
invocation the list should contain the corresponding
Sequence
public double getLogScoreAndPartialDerivation(Sequence seq, int startpos, int endpos, IntList indices, DoubleList partialDer) throws WrongLengthException
DifferentiableSequenceScore
Sequence
beginning at
position start
in the Sequence
and fills lists with
the indices and the partial derivations.getLogScoreAndPartialDerivation
in interface DifferentiableSequenceScore
seq
- the Sequence
startpos
- the start position in the Sequence
endpos
- the end position (inclusive) in the Sequence
indices
- an IntList
of indices, after method invocation the
list should contain the indices i where
partialDer
- a DoubleList
of partial derivations, after method
invocation the list should contain the corresponding
Sequence
WrongLengthException
public int getNumberOfRecommendedStarts()
DifferentiableSequenceScore
getNumberOfRecommendedStarts
in interface DifferentiableSequenceScore
public double getInitialClassParam(double classProb)
DifferentiableSequenceScore
DifferentiableSequenceScore
is responsible for, based on the class
probability classProb
.getInitialClassParam
in interface DifferentiableSequenceScore
classProb
- the class probabilitypublic double[] getLogScoreFor(DataSet data) throws Exception
SequenceScore
SequenceScore.getLogScoreFor(Sequence)
.getLogScoreFor
in interface SequenceScore
data
- the data set of sequencesException
- if something went wrongSequenceScore.getLogScoreFor(Sequence)
public void getLogScoreFor(DataSet data, double[] res) throws Exception
SequenceScore
double
-array.
SequenceScore.getLogScoreFor(Sequence)
.getLogScoreFor
in interface SequenceScore
data
- 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
SequenceScore
StorableResult
.getCharacteristics
in interface SequenceScore
Exception
- if some of the characteristics could not be definedStorableResult
public NumericalResultSet getNumericalCharacteristics() throws Exception
SequenceScore
SequenceScore.getCharacteristics()
.getNumericalCharacteristics
in interface SequenceScore
Exception
- if some of the characteristics could not be defined