|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.jstacs.models.AbstractModel de.jstacs.models.UniformModel
public class UniformModel
This class represents a uniform model. Sometimes it's also called uninformed model. It can be used if nothing is known about a statistical process.
Field Summary |
---|
Fields inherited from class de.jstacs.models.AbstractModel |
---|
alphabets, length |
Constructor Summary | |
---|---|
UniformModel(AlphabetContainer alphabet)
Creates a new UniformModel using a given AlphabetContainer . |
|
UniformModel(StringBuffer stringBuff)
The standard constructor for the interface Storable . |
Method Summary | |
---|---|
UniformModel |
clone()
Follows the conventions of Object 's clone() -method. |
Sample |
emitSample(int n,
int... lengths)
This method returns a Sample object containing artificial
sequence(s). |
void |
fromXML(StringBuffer representation)
This method should only be used by the constructor that works on a StringBuffer . |
String |
getInstanceName()
Should return a short instance name such as iMM(0), BN(2), ... |
double |
getLogPriorTerm()
Returns a value that is proportional to the log of the prior. |
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 Model.getCharacteristics() . |
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 is trained, false otherwise. |
String |
toString()
Returns the String "". |
StringBuffer |
toXML()
This method returns an XML representation as StringBuffer of an
instance of the implementing class. |
void |
train(Sample data,
double[] weights)
Deprecated. |
Methods inherited from class de.jstacs.models.AbstractModel |
---|
getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogProbFor, getLogProbFor, getLogProbFor, getPriorTerm, getProbFor, getProbFor, set, setNewAlphabetContainerInstance, train |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UniformModel(AlphabetContainer alphabet)
UniformModel
using a given AlphabetContainer
.
alphabet
- the alphabets used in the modelpublic UniformModel(StringBuffer stringBuff) throws NonParsableException
Storable
.
Creates a new UniformModel
out of a StringBuffer
.
stringBuff
- the StringBuffer
to be parsed
NonParsableException
- if the StringBuffer
is not parsableMethod Detail |
---|
public UniformModel clone() throws CloneNotSupportedException
AbstractModel
Object
's clone()
-method.
clone
in interface Model
clone
in class AbstractModel
AbstractModel
(the member-AlphabetContainer
isn't deeply cloned since
it is assumed to be immutable). The type of the returned object
is defined by the class X
directly inherited from
AbstractModel
. Hence X
's
clone()
-method should work as:Object o = (X)super.clone();
o
defined by
X
that are not of simple data-types like
int
, double
, ... have to be deeply
copied return o
CloneNotSupportedException
- if something went wrong while cloningpublic double getProbFor(Sequence sequence, int startpos, int endpos) throws IllegalArgumentException, WrongAlphabetException
Model
Model.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
IllegalArgumentException
WrongAlphabetException
public boolean isTrained()
true
if the model is trained, false
otherwise.
true
if the model is trained, false
otherwisepublic void fromXML(StringBuffer representation) throws NonParsableException
AbstractModel
StringBuffer
. It is the counter part of Storable.toXML()
.
fromXML
in class AbstractModel
representation
- the XML representation of the model
NonParsableException
- if the StringBuffer
is not parsable or the
representation is conflictingAbstractModel.AbstractModel(StringBuffer)
public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.
public String toString()
toString
in interface Model
toString
in class Object
String
@Deprecated public void train(Sample data, double[] weights) throws IOException
Model
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
IOException
Sample.getElementAt(int)
,
Sample.ElementEnumerator
public Sample emitSample(int n, int... lengths) throws Exception
Model
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 (
Model.getLength()
).
Exception
.
emitSample
in interface Model
emitSample
in class AbstractModel
n
- the number of sequences that should be contained in the
returned samplelengths
- 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
public double getLogPriorTerm() throws Exception
Model
Exception
- if something went wrongModel.getPriorTerm()
public byte getMaximalMarkovOrder() throws UnsupportedOperationException
Model
getMaximalMarkovOrder
in interface Model
getMaximalMarkovOrder
in class AbstractModel
UnsupportedOperationException
- if the model can't give a proper answerpublic NumericalResultSet getNumericalCharacteristics() throws Exception
Model
Model.getCharacteristics()
.
Exception
- if some of the characteristics could not be definedpublic String getInstanceName()
Model
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |