|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Model
This interface defines all methods for a probabilistic model.
Method Summary | |
---|---|
Model |
clone()
Creates a clone (deep copy) of the current Model instance. |
Sample |
emitSample(int numberOfSequences,
int... seqLength)
This method returns a Sample object containing artificial
sequence(s). |
AlphabetContainer |
getAlphabetContainer()
Returns the container of alphabets that were used when constructing the model. |
ResultSet |
getCharacteristics()
Returns some information characterizing or describing the current instance of the model. |
String |
getInstanceName()
Should return a short instance name such as iMM(0), BN(2), ... |
int |
getLength()
Returns the length of sequences this model can classify. |
double |
getLogPriorTerm()
Returns a value that is proportional to the log of the prior. |
double[] |
getLogProbFor(Sample data)
This method computes the logarithm of the probabilities of all sequences in the given sample. |
void |
getLogProbFor(Sample data,
double[] res)
This method computes and stores the logarithm of the probabilities for any sequence in the sample in the given double -array. |
double |
getLogProbFor(Sequence sequence)
Returns the logarithm of the probability of the given sequence given the model. |
double |
getLogProbFor(Sequence sequence,
int startpos)
Returns the logarithm of the probability of (a part of) the given sequence given the model. |
double |
getLogProbFor(Sequence sequence,
int startpos,
int endpos)
Returns the logarithm of the probability of (a part of) the given sequence given the model. |
byte |
getMaximalMarkovOrder()
This method returns the maximal used Markov order, if possible. |
NumericalResultSet |
getNumericalCharacteristics()
Returns the subset of numerical values that are also returned by getCharacteristics() . |
double |
getPriorTerm()
Returns a value that is proportional to the prior. |
double |
getProbFor(Sequence sequence)
Returns the probability of the given sequence given the model. |
double |
getProbFor(Sequence sequence,
int startpos)
Returns the probability of (a part of) the given sequence given the model. |
double |
getProbFor(Sequence sequence,
int startpos,
int endpos)
Returns the probability of (a part of) the given sequence given the model. |
boolean |
isTrained()
Returns true if the model has been trained successfully,
false otherwise. |
boolean |
setNewAlphabetContainerInstance(AlphabetContainer abc)
This method tries to set a new instance of an AlphabetContainer
for the current model. |
String |
toString()
Should give a simple representation (text) of the model as String
. |
void |
train(Sample data)
Trains the Model object given the data as Sample . |
void |
train(Sample data,
double[] weights)
Trains the Model object given the data as Sample using
the specified weights. |
Methods inherited from interface de.jstacs.Storable |
---|
toXML |
Method Detail |
---|
Model clone() throws CloneNotSupportedException
Model
instance.
CloneNotSupportedException
- if something went wrong while cloningvoid train(Sample data) throws Exception
Model
object given the data as Sample
. train(data1)
; train(data2)
should be a fully trained model over data2
and not over
data1+data2
. All parameters of the model were given by the
call of the constructor.
data
- the given sequences as Sample
Exception
- if the training did not succeedSample.getElementAt(int)
,
Sample.ElementEnumerator
void train(Sample data, double[] weights) throws Exception
Model
object given the data as Sample
using
the specified weights. The weight at position i belongs to the element at
position i. So the array weight
should have the number of
sequences in the sample as dimension. (Optionally it is possible to use
weight == null
if all weights have the value one.)train(data1)
; train(data2)
should be a fully trained model over data2
and not over
data1+data2
. All parameters of the model were given by the
call of the constructor.
data
- the given sequences as Sample
weights
- the weights of the elements, each weight should be
non-negative
Exception
- if the training did not succeed (e.g. the dimension of
weights
and the number of sequences in the
sample do not match)Sample.getElementAt(int)
,
Sample.ElementEnumerator
double getProbFor(Sequence sequence) throws NotTrainedException, Exception
length
and the alphabets
define the type of
data that can be modeled and therefore both has to be checked.
sequence
- the given sequence for which the probability/the value of the
density function should be returned
Exception
- if the sequence could not be handled by the model
NotTrainedException
- if the model is not trained yetdouble getProbFor(Sequence sequence, int startpos) throws NotTrainedException, Exception
startpos
. E.g. the fixed length is 12. The length
of the given sequence is 30 and the
startpos
=15 the probability
of the part from position 15 to 26 (inclusive) given the model should be returned.
length
and the alphabets
define the type of
data that can be modeled and therefore both has to be checked.
sequence
- the given sequencestartpos
- the start position within the given sequence
Exception
- if the sequence could not be handled by the model
NotTrainedException
- if the model is not trained yetdouble getProbFor(Sequence sequence, int startpos, int endpos) throws NotTrainedException, Exception
getProbFor(Sequence, int)
by the fact, that the model could be
e.g. homogeneous and therefore the length of the sequences, whose
probability should be returned, is not fixed. Additionally the end
position of the part of the given sequence is given and the probability
of the part from position startpos
to endpos
(inclusive) should be returned.
length
and the alphabets
define the type of
data that can be modeled and therefore both has to be checked.
sequence
- the given sequencestartpos
- the start position within the given sequenceendpos
- the last position to be taken into account
Exception
- if the sequence could not be handled (e.g.
startpos > endpos
, endpos
> sequence.length
, ...) by the model
NotTrainedException
- if the model is not trained yetdouble getLogProbFor(Sequence sequence, int startpos, int endpos) throws Exception
getProbFor(Sequence, int, int)
sequence
- the given sequencestartpos
- the start position within the given sequenceendpos
- the last position to be taken into account
Exception
- if the sequence could not be handled (e.g.
startpos >
, endpos
> sequence.length
, ...) by the model
NotTrainedException
- if the model is not trained yetgetProbFor(Sequence, int, int)
double getLogProbFor(Sequence sequence, int startpos) throws Exception
getProbFor(Sequence, int)
sequence
- the given sequencestartpos
- the start position within the given sequence
Exception
- if the sequence could not be handled by the model
NotTrainedException
- if the model is not trained yetgetProbFor(Sequence, int)
double getLogProbFor(Sequence sequence) throws Exception
getProbFor(Sequence)
sequence
- the given sequence for which the logarithm of the
probability/the value of the density function should be
returned
Exception
- if the sequence could not be handled by the model
NotTrainedException
- if the model is not trained yetgetProbFor(Sequence)
double[] getLogProbFor(Sample data) throws Exception
getLogProbFor(Sequence)
.
data
- the sample of sequences
Exception
- if something went wronggetLogProbFor(Sequence)
void getLogProbFor(Sample data, double[] res) throws Exception
double
-array.
getLogProbFor(Sequence)
.
data
- the sample of sequencesres
- the array for the results, has to have length
data.getNumberOfElements()
(which returns the
number of sequences in the sample)
Exception
- if something went wronggetLogProbFor(Sample)
double getPriorTerm() throws Exception
Exception
- if something went wrongdouble getLogPriorTerm() throws Exception
Exception
- if something went wronggetPriorTerm()
Sample emitSample(int numberOfSequences, int... seqLength) throws NotTrainedException, Exception
Sample
object containing artificial
sequence(s).
emitSample( int n, int l )
should return a sample with
n
sequences of length l
.
emitSample( int n, int[] l )
should return a sample with
n
sequences which have a sequence length corresponding to
the entry in the given array l
.
emitSample( int n )
and
emitSample( int n, null )
should return a sample with
n
sequences of length of the model (
getLength()
).
Exception
.
numberOfSequences
- the number of sequences that should be contained in the
returned sampleseqLength
- the length of the sequences for a homogeneous model; for an
inhomogeneous model this parameter should be null
or an array of size 0.
Sample
containing the artificial sequence(s)
Exception
- if the emission did not succeed
NotTrainedException
- if the model is not trained yetSample
AlphabetContainer getAlphabetContainer()
String getInstanceName()
int getLength()
byte getMaximalMarkovOrder() throws UnsupportedOperationException
UnsupportedOperationException
- if the model can't give a proper answerboolean isTrained()
true
if the model has been trained successfully,
false
otherwise.
true
if the model has been trained successfully,
false
otherwiseResultSet getCharacteristics() throws Exception
StorableResult
.
Exception
- if some of the characteristics could not be definedStorableResult
NumericalResultSet getNumericalCharacteristics() throws Exception
getCharacteristics()
.
Exception
- if some of the characteristics could not be definedString toString()
String
.
toString
in class Object
String
boolean setNewAlphabetContainerInstance(AlphabetContainer abc)
AlphabetContainer
for the current model. This instance has to be consistent with the
underlying instance of an AlphabetContainer
.
abc
- the alphabets in an AlphabetContainer
true
if the new instance could be setgetAlphabetContainer()
,
AlphabetContainer.checkConsistency(AlphabetContainer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |