|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
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 sequence 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 the given sequence given the model. |
double |
getLogProbFor(Sequence sequence,
int startpos,
int endpos)
Returns the logarithm of the probability 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 getCharacteristsics . |
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 the given sequence given the model. |
double |
getProbFor(Sequence sequence,
int startpos,
int endpos)
Returns the probability 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 AbstractModel 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
void train(Sample data) throws Exception
Sample
.
data
- the given sequences as Sample
Exception
- an Exception should be thrown if the training did not succeed.Sample.getElementAt(int)
,
Sample.ElementEnumerator
void train(Sample data, double[] weights) throws Exception
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.)
data
- the given sequencesweights
- the weights of the elements, each weight should be non-negative
Exception
- an Exception should be thrown if the training did not succeed (e.g. the weights dimension of weights
and number of samples does not match).Sample.getElementAt(int)
,
Sample.ElementEnumerator
double getProbFor(Sequence sequence) throws NotTrainedException, Exception
length
and alphabets
define the type of data that can be modeled and therefore
both has to be checked.
sequence
- the sequence
Exception
- an Exception should be thrown if the sequence could not be handled by the model
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.double getProbFor(Sequence sequence, int startpos) throws NotTrainedException, Exception
length
and alphabets
define the type of data that can be modeled and therefore
both has to be checked.
sequence
- the sequencestartpos
- the start position
Exception
- an Exception should be thrown if the sequence could not be handled by the model
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.double getProbFor(Sequence sequence, int startpos, int endpos) throws NotTrainedException, Exception
startpos
to endpos
(inclusive) should be returned.
length
and alphabets
define the type of data that can be modeled and therefore
both has to be checked.
sequence
- the sequencestartpos
- the start positionendpos
- the last position to be taken into account
Exception
- an Exception should be thrown if the sequence could not be handled (e.g. startpos > endpos, endpos
> sequence.length, ...) by the model
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.double getLogProbFor(Sequence sequence, int startpos, int endpos) throws Exception
getProbFor(Sequence, int, int)
sequence
- the sequencestartpos
- the start positionendpos
- the last position to be taken into account
Exception
- an Exception should be thrown if the sequence could not be handled (e.g. startpos > endpos, endpos
> sequence.length, ...) by the model
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.getProbFor(Sequence, int, int)
double getLogProbFor(Sequence sequence, int startpos) throws Exception
getProbFor(Sequence, int)
sequence
- the sequencestartpos
- the start position
Exception
- an Exception should be thrown if the sequence could not be handled by the model
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.getProbFor(Sequence, int)
double getLogProbFor(Sequence sequence) throws Exception
getProbFor(Sequence)
sequence
- the sequence
Exception
- an Exception should be thrown if the sequence could not be handled by the model
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.getProbFor(Sequence)
double[] getLogProbFor(Sample data) throws Exception
getLogProbFor(Sequence)
data
- the sample
Exception
- if something went wronggetLogProbFor(Sequence)
void getLogProbFor(Sample data, double[] res) throws Exception
double
array.
getLogProbFor(Sequence)
data
- the sampleres
- the array for the results, has to have length data.getNumberOfElements()
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
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 array
emitSample( int n )
and emitSample( int n, null )
should return a sample with
n
sequences of length of the model (getLength()
)
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.
Exception
- an Exception should be thrown if the emission did not succeed.
NotTrainedException
- a NotTrainedException should be thrown if the model is not trained yet.Sample
AlphabetContainer getAlphabetContainer()
String getInstanceName()
int getLength()
byte getMaximalMarkovOrder() throws UnsupportedOperationException
UnsupportedOperationException
- if the model can't give a proper answerboolean isTrained()
ResultSet getCharacteristics() throws Exception
ObjectResult
Exception
- an Exception
is thrown if some of the characteristics could not be definedStorableResult
NumericalResultSet getNumericalCharacteristics() throws Exception
getCharacteristsics
.
Exception
- an Exception
is thrown if some of the characteristics could not be definedString toString()
toString
in class Object
boolean setNewAlphabetContainerInstance(AlphabetContainer abc)
abc
- the alphabets
true
if the new instance could be setgetAlphabetContainer()
,
AlphabetContainer.checkConsistency(AlphabetContainer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |