5 #ifndef BPP_NUMERIC_HMM_RESCALEDHMMLIKELIHOOD_H 6 #define BPP_NUMERIC_HMM_RESCALEDHMMLIKELIHOOD_H 9 #include "../AbstractParametrizable.h" 10 #include "../Matrix/Matrix.h" 98 std::shared_ptr<HmmStateAlphabet> hiddenAlphabet,
99 std::shared_ptr<HmmTransitionMatrix> transitionMatrix,
100 std::shared_ptr<HmmEmissionProbabilities> emissionProbabilities,
101 const std::string& prefix);
109 likelihood_(lik.likelihood_),
110 dLikelihood_(lik.dLikelihood_),
111 d2Likelihood_(lik.d2Likelihood_),
112 backLikelihood_(lik.backLikelihood_),
113 backLikelihoodUpToDate_(lik.backLikelihoodUpToDate_),
114 scales_(lik.scales_),
115 dScales_(lik.dScales_),
116 d2Scales_(lik.d2Scales_),
117 logLik_(lik.logLik_),
118 breakPoints_(lik.breakPoints_),
119 nbStates_(lik.nbStates_),
120 nbSites_(lik.nbSites_)
123 transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_);
124 emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_);
130 AbstractParametrizable::operator=(lik);
148 transitionMatrix_->setHmmStateAlphabet(hiddenAlphabet_);
149 emissionProbabilities_->setHmmStateAlphabet(hiddenAlphabet_);
178 breakPoints_ = breakPoints;
180 backLikelihoodUpToDate_ =
false;
202 void setNamespace(
const std::string& nameSpace)
override;
230 #endif // BPP_NUMERIC_HMM_RESCALEDHMMLIKELIHOOD_H void setBreakPoints(const std::vector< size_t > &breakPoints) override
double getLogLikelihood() const override
std::vector< size_t > breakPoints_
void computeDForward_() const
HmmStateAlphabet & hmmStateAlphabet() override
void computeDLikelihood_() const override
std::vector< double > likelihood_
The likelihood arrays.
std::vector< double > dScales_
double getLikelihoodForASite(size_t site) const override
Get the likelihood for a site, and its derivatives.
A partial implementation of the Parametrizable interface.
void computeD2Forward_() const
HmmEmissionProbabilities & hmmEmissionProbabilities() override
bool backLikelihoodUpToDate_
Interface for computing emission probabilities in a Hidden Markov Model.
void setNamespace(const std::string &nameSpace) override
Set the namespace for the parameter names.
std::shared_ptr< const HmmEmissionProbabilities > getHmmEmissionProbabilities() const override
void getHiddenStatesPosteriorProbabilities(std::vector< std::vector< double >> &probs, bool append=false) const override
virtual ~RescaledHmmLikelihood()
std::vector< std::vector< double > > backLikelihood_
backward likelihood
The parameter list object.
std::shared_ptr< HmmEmissionProbabilities > emissionProbabilities_
const HmmStateAlphabet & hmmStateAlphabet() const override
RescaledHmmLikelihood(std::shared_ptr< HmmStateAlphabet > hiddenAlphabet, std::shared_ptr< HmmTransitionMatrix > transitionMatrix, std::shared_ptr< HmmEmissionProbabilities > emissionProbabilities, const std::string &prefix)
Build a new RescaledHmmLikelihood object.
std::vector< double > d2Scales_
std::shared_ptr< HmmStateAlphabet > getHmmStateAlphabet() override
void setParametersValues(const ParameterList ¶meters) override
Update the parameters from parameters.
void setParameters(const ParameterList &pl) override
Set the point where the function must be computed.
Vdouble getLikelihoodForEachSite() const override
Get the likelihood for each site.
void fireParameterChanged(const ParameterList &pl) override
Notify the class when one or several parameters have changed.
const HmmTransitionMatrix & hmmTransitionMatrix() const override
std::vector< double > Vdouble
std::vector< double > scales_
scales for likelihood computing
A simple implementation of hidden Markov models recursion.
RescaledHmmLikelihood(const RescaledHmmLikelihood &lik)
std::vector< std::vector< double > > d2Likelihood_
partial impmementation of Hmm Likelihoods.
std::shared_ptr< const HmmTransitionMatrix > getHmmTransitionMatrix() const override
const std::vector< size_t > & getBreakPoints() const override
RescaledHmmLikelihood & operator=(const RescaledHmmLikelihood &lik)
std::shared_ptr< HmmStateAlphabet > hiddenAlphabet_
The alphabet describing the hidden states.
AbstractHmmLikelihood & operator=(const AbstractHmmLikelihood &adhlik)
std::shared_ptr< HmmEmissionProbabilities > getHmmEmissionProbabilities() override
std::shared_ptr< HmmTransitionMatrix > transitionMatrix_
double getDLogLikelihoodForASite(size_t site) const override
void computeBackward_() const
RescaledHmmLikelihood * clone() const override
Create a copy of this object and send a pointer to it.
HmmTransitionMatrix & hmmTransitionMatrix() override
std::shared_ptr< HmmTransitionMatrix > getHmmTransitionMatrix() override
Describe the transition probabilities between hidden states of a Hidden Markov Model.
void computeD2Likelihood_() const override
Vdouble getHiddenStatesPosteriorProbabilitiesForASite(size_t site) const override
double getValue() const override
Get the value of the function at the current point.
std::shared_ptr< const HmmStateAlphabet > getHmmStateAlphabet() const override
const HmmEmissionProbabilities & hmmEmissionProbabilities() const override
double getD2LogLikelihoodForASite(size_t site) const override
std::vector< std::vector< double > > dLikelihood_
derivatec of forward likelihood