5 #ifndef BPP_NUMERIC_HMM_LOWMEMORYRESCALEDHMMLIKELIHOOD_H 6 #define BPP_NUMERIC_HMM_LOWMEMORYRESCALEDHMMLIKELIHOOD_H 9 #include "../AbstractParametrizable.h" 10 #include "../Matrix/Matrix.h" 75 std::shared_ptr<HmmStateAlphabet> hiddenAlphabet,
76 std::shared_ptr<HmmTransitionMatrix> transitionMatrix,
77 std::shared_ptr<HmmEmissionProbabilities> emissionProbabilities,
78 const std::string& prefix,
79 size_t maxSize = 1000000);
87 likelihood1_(lik.likelihood1_),
88 likelihood2_(lik.likelihood2_),
90 maxSize_(lik.maxSize_),
91 breakPoints_(lik.breakPoints_),
92 nbStates_(lik.nbStates_),
93 nbSites_(lik.nbSites_)
96 transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_);
97 emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_);
103 AbstractParametrizable::operator=(lik);
116 transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_);
117 emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_);
146 breakPoints_ = breakPoints;
161 void setNamespace(
const std::string& nameSpace)
override;
167 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::getLikelihoodForASite. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));
173 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::getLikelihoodForEachSite. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));
178 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::getHiddenStatesPosteriorProbabilitiesForASite. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));
183 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::getHiddenStatesPosteriorProbabilities. This class can't compute posterior probabilities, use RescaledHmmLikelihood instead."));
191 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::computeDLikelihood_. Use RescaledHmmLikelihood instead."));
196 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::computeD2Likelihood_. Use RescaledHmmLikelihood instead."));
201 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::getDLogLikelihoodForASite. Use RescaledHmmLikelihood instead."));
207 throw (
NotImplementedException(
"LowMemoryRescaledHmmLikelihood::getD2LogLikelihoodForASite. Use RescaledHmmLikelihood instead."));
212 #endif // BPP_NUMERIC_HMM_LOWMEMORYRESCALEDHMMLIKELIHOOD_H
std::shared_ptr< HmmTransitionMatrix > getHmmTransitionMatrix() override
void setParameters(const ParameterList &pl) override
Set the point where the function must be computed.
std::shared_ptr< HmmTransitionMatrix > transitionMatrix_
std::shared_ptr< HmmEmissionProbabilities > emissionProbabilities_
std::shared_ptr< const HmmTransitionMatrix > getHmmTransitionMatrix() const override
void setNamespace(const std::string &nameSpace) override
Set the namespace for the parameter names.
A partial implementation of the Parametrizable interface.
double getLogLikelihood() const override
const std::vector< size_t > & getBreakPoints() const override
HmmEmissionProbabilities & hmmEmissionProbabilities() override
A modified implementation of the RescaledHmmLikelihood implementation, with lower memory usage...
Interface for computing emission probabilities in a Hidden Markov Model.
HmmTransitionMatrix & hmmTransitionMatrix() override
void getHiddenStatesPosteriorProbabilities(std::vector< std::vector< double >> &probs, bool append=false) const override
double getLikelihoodForASite(size_t site) const override
Get the likelihood for a site, and its derivatives.
void computeDLikelihood_() const override
void setBreakPoints(const std::vector< size_t > &breakPoints) override
virtual ~LowMemoryRescaledHmmLikelihood()
The parameter list object.
std::shared_ptr< HmmStateAlphabet > hiddenAlphabet_
The alphabet describing the hidden states.
Vdouble getLikelihoodForEachSite() const override
Get the likelihood for each site.
void setParametersValues(const ParameterList ¶meters) override
Update the parameters from parameters.
std::shared_ptr< const HmmEmissionProbabilities > getHmmEmissionProbabilities() const override
std::shared_ptr< HmmStateAlphabet > getHmmStateAlphabet() override
This exception is sent when a given method is not implemented.
double getDLogLikelihoodForASite(size_t site) const override
void computeD2Likelihood_() const override
const HmmEmissionProbabilities & hmmEmissionProbabilities() const override
double getValue() const override
Get the value of the function at the current point.
double getD2LogLikelihoodForASite(size_t site) const override
void fireParameterChanged(const ParameterList &pl) override
Notify the class when one or several parameters have changed.
std::vector< double > Vdouble
partial impmementation of Hmm Likelihoods.
AbstractHmmLikelihood & operator=(const AbstractHmmLikelihood &adhlik)
std::shared_ptr< HmmEmissionProbabilities > getHmmEmissionProbabilities() override
std::vector< double > likelihood2_
std::vector< double > likelihood1_
The likelihood array.
std::shared_ptr< const HmmStateAlphabet > getHmmStateAlphabet() const override
LowMemoryRescaledHmmLikelihood * clone() const override
Create a copy of this object and send a pointer to it.
LowMemoryRescaledHmmLikelihood & operator=(const LowMemoryRescaledHmmLikelihood &lik)
const HmmStateAlphabet & hmmStateAlphabet() const override
LowMemoryRescaledHmmLikelihood(std::shared_ptr< HmmStateAlphabet > hiddenAlphabet, std::shared_ptr< HmmTransitionMatrix > transitionMatrix, std::shared_ptr< HmmEmissionProbabilities > emissionProbabilities, const std::string &prefix, size_t maxSize=1000000)
Build a new LowMemoryRescaledHmmLikelihood object.
const HmmTransitionMatrix & hmmTransitionMatrix() const override
Vdouble getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const override
Describe the transition probabilities between hidden states of a Hidden Markov Model.
LowMemoryRescaledHmmLikelihood(const LowMemoryRescaledHmmLikelihood &lik)
std::vector< size_t > breakPoints_
HmmStateAlphabet & hmmStateAlphabet() override