public class SimpleSamplingState extends SimpleState implements SamplingState
e, forward, name| Constructor and Description |
|---|
SimpleSamplingState(SamplingEmission e,
String name,
boolean forward)
This constructor creates a state that can be used in a HMM that obtains its parameters from sampling.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptParameters()
This methods accepts the drawn parameters.
|
void |
drawParametersFromStatistic()
This method draws the parameters using a sufficient statistic representing a posteriori
density.
|
void |
extendSampling(int sampling,
boolean append)
This method allows to extend a sampling.
|
double |
getLogGammaScoreForCurrentStatistic()
This method calculates a score for the current statistics, which is independent from the current parameters
In general the gamma-score is a product of gamma-functions parameterized with the current statistics
|
double |
getLogPosteriorFromStatistic()
This method calculates the a-posteriori probability for the current statistics
|
void |
initForSampling(int starts)
This method initializes the instance for the sampling.
|
boolean |
isInSamplingMode()
This method returns
true if the object is currently used in
a sampling, otherwise false. |
boolean |
parseNextParameterSet()
This method allows the user to parse the next set of parameters (from a
file).
|
boolean |
parseParameterSet(int sampling,
int n)
This method allows the user to parse the set of parameters with index
n of a certain sampling (from a file). |
void |
samplingStopped()
This method is the opposite of the method
SamplingComponent.extendSampling(int, boolean). |
addToStatistic, getGraphvizNodeOptions, getLogScoreFor, getName, isSilent, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddToStatisticgetGraphvizNodeOptions, getLogScoreFor, isSilent, toStringpublic SimpleSamplingState(SamplingEmission e, String name, boolean forward)
e - the emissionname - the name of the emission (e.g. for the Graphviz representation)forward - a switch whether to use the forward or the reverse strandpublic void drawParametersFromStatistic()
throws Exception
SamplingFromStatisticSamplingComponent.acceptParameters() so that they can later be parsed using the
methods of the interface.
SamplingComponent.initForSampling(int) should be
called.drawParametersFromStatistic in interface SamplingFromStatisticException - if there is a problem with drawing the parameters, the initialization, ...SamplingComponent.initForSampling(int),
SamplingComponent.acceptParameters()public void extendSampling(int sampling,
boolean append)
throws IOException
SamplingComponentextendSampling in interface SamplingComponentsampling - the index of the samplingappend - whether to append the sampled parameters to an existing file
or to overwrite the fileIOException - if the file could not be handled correctlypublic void initForSampling(int starts)
throws IOException
SamplingComponentinitForSampling in interface SamplingComponentstarts - the number of different sampling starts that will be doneIOException - if something went wrongFile.createTempFile(String, String, java.io.File )public boolean isInSamplingMode()
SamplingComponenttrue if the object is currently used in
a sampling, otherwise false.isInSamplingMode in interface SamplingComponenttrue if the object is currently used in a sampling,
otherwise falsepublic boolean parseNextParameterSet()
SamplingComponentparseNextParameterSet in interface SamplingComponenttrue if the parameters could be parsed, otherwise
falseSamplingComponent.parseParameterSet(int, int)public boolean parseParameterSet(int sampling,
int n)
throws Exception
SamplingComponentn of a certain sampling (from a file). The
internal numbering should start with 0. The parameter set with index 0 is
the initial (random) parameter set. It is recommended that a series of
parameter sets is accessed by the following lines:
for( sampling = 0; sampling < numSampling; sampling++ )
{
boolean b = parseParameterSet( sampling, n );
while( b )
{
//do something
b = parseNextParameterSet();
}
}
parseParameterSet in interface SamplingComponentsampling - the index of the samplingn - the index of the parameter settrue if the parameter set could be parsedException - if there is a problem with parsing the parametersSamplingComponent.parseNextParameterSet()public void samplingStopped()
throws IOException
SamplingComponentSamplingComponent.extendSampling(int, boolean). It can be
used for closing any streams of writer, ...samplingStopped in interface SamplingComponentIOException - if something went wrongSamplingComponent.extendSampling(int, boolean)public void acceptParameters()
throws IOException
SamplingComponentacceptParameters in interface SamplingComponentIOException - if the file could not be handled correctlypublic double getLogGammaScoreForCurrentStatistic()
SamplingStategetLogGammaScoreForCurrentStatistic in interface SamplingStatepublic double getLogPosteriorFromStatistic()
SamplingFromStatisticgetLogPosteriorFromStatistic in interface SamplingFromStatistic