bpp-phyl3
3.0.0
|
A simple implementation of hidden Markov models recursion, in DataFlow implementation. More...
#include <Bpp/Phyl/Likelihood/PhyloLikelihoods/HmmLikelihood_DF.h>
Public Member Functions | |
HmmLikelihood_DF (Context &context, std::shared_ptr< HmmStateAlphabet > hiddenAlphabet, std::shared_ptr< HmmTransitionMatrix > transitionMatrix, std::shared_ptr< HmmPhyloEmissionProbabilities > emissionProbabilities, const std::string &prefix="") | |
Build a new HmmLikelihood_DF object. More... | |
HmmLikelihood_DF (const HmmLikelihood_DF &lik) | |
virtual | ~HmmLikelihood_DF () |
HmmLikelihood_DF * | clone () const |
void | makeLikelihoods () |
const HmmStateAlphabet & | hmmStateAlphabet () const |
HmmStateAlphabet & | hmmStateAlphabet () |
const Eigen::MatrixXd & | getHmmTransitionMatrix () const |
const HmmPhyloEmissionProbabilities & | getHmmEmissionProbabilities () const |
HmmPhyloEmissionProbabilities & | getHmmEmissionProbabilities () |
void | setParameters (const ParameterList &pl) |
void | setNamespace (const std::string &nameSpace) |
const Eigen::MatrixXd & | getHiddenStatesPosteriorProbabilities () const |
Eigen::VectorXd | getHiddenStatesPosteriorProbabilitiesForASite (size_t site) const |
DataLik | getLikelihoodForASite (size_t site) const |
SiteLikelihoodsRef | getSiteLikelihoods (bool shrunk=false) |
void | setSiteLikelihoods (SiteLikelihoodsRef ll, bool shrunk=false) |
DataLik | getLikelihoodForASite (size_t pos, bool shrunk=false) |
DataLik | getLogLikelihoodForASite (size_t pos, bool shrunk=false) |
VDataLik | getLikelihoodPerSite () |
Get the likelihood for each site. More... | |
void | cleanAllLikelihoods () |
ValueRef< DataLik > | getLikelihoodNode () |
virtual bool | isInitialized () const |
const Context & | getContext () const |
void | setLikelihoodNode (ValueRef< DataLik > ll) |
bool | hasIndependentParameter (const std::string &name) const |
const ParameterList & | getIndependentParameters () const |
size_t | getNumberOfIndependentParameters () const |
void | aliasParameters (const std::string &p1, const std::string &p2) |
void | aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose) |
void | unaliasParameters (const std::string &p1, const std::string &p2) |
ParameterList | getAliasedParameters (const ParameterList &pl) const |
ParameterList | getFromParameters (const ParameterList &pl) const |
virtual std::vector< std::string > | getAlias (const std::string &name) const |
virtual std::map< std::string, std::string > | getAliases () const |
std::string | getFrom (const std::string &name) const |
bool | hasParameter (const std::string &name) const override |
const ParameterList & | getParameters () const override |
const Parameter & | parameter (const std::string &name) const override |
const std::shared_ptr< Parameter > & | getParameter (const std::string &name) const |
double | getParameterValue (const std::string &name) const override |
void | setAllParametersValues (const ParameterList ¶meters) override |
void | setParameterValue (const std::string &name, double value) override |
void | setParametersValues (const ParameterList ¶meters) override |
bool | matchParametersValues (const ParameterList ¶meters) override |
void | removeConstraint (const std::string &name) override |
void | setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override |
size_t | getNumberOfParameters () const override |
std::string | getNamespace () const override |
std::string | getParameterNameWithoutNamespace (const std::string &name) const override |
virtual void | fireParameterChanged (const ParameterList ¶meters) |
Protected Member Functions | |
Context & | getContext_ () |
ValueRef< DataLik > | getLikelihoodNode_ () |
const std::shared_ptr< Parameter > & | getParameter (size_t i) const |
std::shared_ptr< Parameter > & | getParameter (size_t i) |
void | addParameter_ (Parameter *parameter) |
void | addParameters_ (const ParameterList ¶meters) |
void | shareParameter_ (const std::shared_ptr< Parameter > ¶meter) |
void | shareParameters_ (const ParameterList ¶meters) |
void | includeParameters_ (const ParameterList ¶meters) |
void | deleteParameter_ (size_t index) |
void | deleteParameter_ (std::string &name) |
void | deleteParameters_ (const std::vector< std::string > &names) |
void | resetParameters_ () |
Parameter & | getParameter_ (const std::string &name) |
Parameter & | getParameter_ (size_t index) |
const Parameter & | getParameter_ (size_t index) const |
Parameter & | getParameterWithNamespace_ (const std::string &name) |
const Parameter & | getParameterWithNamespace_ (const std::string &name) const |
ParameterList & | getParameters_ () override |
Protected Attributes | |
std::shared_ptr< HmmStateAlphabet > | hiddenAlphabet_ |
The alphabet describing the hidden states. More... | |
std::shared_ptr< HmmPhyloEmissionProbabilities > | emissionProbabilities_ |
std::shared_ptr< ConfiguredTransitionMatrix > | matrix_ |
ValueRef< Eigen::VectorXd > | hmmEq_ |
ValueRef< Eigen::MatrixXd > | hmmTrans_ |
ValueRef< MatrixLik > | hmmEmis_ |
ValueRef< RowLik > | forwardLik_ |
ValueRef< Eigen::MatrixXd > | backwardLik_ |
ValueRef< Eigen::MatrixXd > | hiddenPostProb_ |
Eigen::Index | nbStates_ |
Eigen::Index | nbSites_ |
SiteLikelihoodsRef | siteLikelihoods_ |
SiteLikelihoodsRef | patternedSiteLikelihoods_ |
ValueRef< DataLik > | likelihood_ |
Private Attributes | |
Context & | context_ |
ParameterList | independentParameters_ |
std::map< std::string, std::shared_ptr< AliasParameterListener > > | aliasListenersRegister_ |
ParameterList | parameters_ |
std::string | prefix_ |
A simple implementation of hidden Markov models recursion, in DataFlow implementation.
This class builds DF objects linked with HMM computation, and owns a HmmLikelihoodComputation object.
Definition at line 32 of file HmmLikelihood_DF.h.
HmmLikelihood_DF::HmmLikelihood_DF | ( | Context & | context, |
std::shared_ptr< HmmStateAlphabet > | hiddenAlphabet, | ||
std::shared_ptr< HmmTransitionMatrix > | transitionMatrix, | ||
std::shared_ptr< HmmPhyloEmissionProbabilities > | emissionProbabilities, | ||
const std::string & | prefix = "" |
||
) |
Build a new HmmLikelihood_DF object.
Definition at line 14 of file HmmLikelihood_DF.cpp.
References bpp::AbstractParameterAliasable::addParameters_(), backwardLik_, context_, bpp::NumericMutable< T >::create(), bpp::ForwardHmmLikelihood_DF::create(), bpp::BackwardHmmLikelihood_DF::create(), bpp::ConfiguredParameter::create(), emissionProbabilities_, forwardLik_, bpp::LikelihoodCalculation::getContext_(), hiddenAlphabet_, hiddenPostProb_, hmmEmis_, hmmEq_, hmmTrans_, matrix_, nbSites_, nbStates_, bpp::LikelihoodCalculation::setLikelihoodNode(), bpp::AlignedLikelihoodCalculation::setSiteLikelihoods(), bpp::ParameterList::shareParameter(), bpp::AbstractParameterAliasable::shareParameters_(), and bpp::ThreePoints.
Referenced by clone().
|
inline |
Definition at line 126 of file HmmLikelihood_DF.h.
|
inlinevirtual |
Definition at line 141 of file HmmLikelihood_DF.h.
|
inlinevirtualinherited |
Reimplemented from bpp::LikelihoodCalculation.
Reimplemented in bpp::LikelihoodCalculationSingleProcess, and bpp::LikelihoodCalculationOnABranch.
Definition at line 235 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::cleanAllLikelihoods(), bpp::Context::erase(), bpp::LikelihoodCalculation::getContext_(), bpp::AlignedLikelihoodCalculation::patternedSiteLikelihoods_, and bpp::AlignedLikelihoodCalculation::siteLikelihoods_.
Referenced by bpp::LikelihoodCalculationOnABranch::cleanAllLikelihoods(), and bpp::LikelihoodCalculationSingleProcess::cleanAllLikelihoods().
|
inlinevirtual |
Reimplemented from bpp::AlignedLikelihoodCalculation.
Definition at line 143 of file HmmLikelihood_DF.h.
References HmmLikelihood_DF().
|
inlineinherited |
Definition at line 76 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::context_.
|
inlineprotectedinherited |
Definition at line 110 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::context_.
Referenced by bpp::LikelihoodCalculation::cleanAllLikelihoods(), bpp::AlignedLikelihoodCalculation::cleanAllLikelihoods(), bpp::LikelihoodCalculationOnABranch::expandMatrix(), bpp::LikelihoodCalculationSingleProcess::expandMatrix(), bpp::LikelihoodCalculationOnABranch::expandVector(), bpp::LikelihoodCalculationSingleProcess::expandVector(), HmmLikelihood_DF(), bpp::LikelihoodCalculationSingleProcess::makeForwardLikelihoodTree_(), bpp::LikelihoodCalculationOnABranch::makeLikelihoods(), bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtDAGNode_(), bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtNode_(), bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtRoot_(), bpp::LikelihoodCalculationSingleProcess::makeProcessNodes_(), bpp::LikelihoodCalculationSingleProcess::makeRootFreqs_(), bpp::LikelihoodCalculationSingleProcess::setClockLike(), bpp::LikelihoodCalculationSingleProcess::setNumericalDerivateConfiguration(), and bpp::LikelihoodCalculationSingleProcess::setPatterns_().
|
inline |
Definition at line 171 of file HmmLikelihood_DF.h.
References hiddenPostProb_.
|
inline |
Definition at line 176 of file HmmLikelihood_DF.h.
References hiddenPostProb_.
Referenced by getLikelihoodForASite().
|
inline |
Definition at line 162 of file HmmLikelihood_DF.h.
References emissionProbabilities_.
|
inline |
Definition at line 160 of file HmmLikelihood_DF.h.
References emissionProbabilities_.
|
inline |
Definition at line 158 of file HmmLikelihood_DF.h.
References hmmTrans_.
|
inlineinherited |
Definition at line 198 of file LikelihoodCalculation.h.
References bpp::AlignedLikelihoodCalculation::makeLikelihoods(), bpp::AlignedLikelihoodCalculation::patternedSiteLikelihoods_, and bpp::AlignedLikelihoodCalculation::siteLikelihoods_.
Referenced by bpp::AbstractAlignedPhyloLikelihood::getLikelihoodForASite(), and bpp::AlignedLikelihoodCalculation::getLogLikelihoodForASite().
|
inline |
Definition at line 182 of file HmmLikelihood_DF.h.
References getHiddenStatesPosteriorProbabilitiesForASite(), and hmmEmis_.
Definition at line 63 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::likelihood_, and bpp::LikelihoodCalculation::makeLikelihoods().
Definition at line 115 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::likelihood_.
Referenced by bpp::LikelihoodCalculationSingleProcess::getForwardLikelihoodsAtNodeForClass(), and bpp::LikelihoodCalculationSingleProcess::getSiteLikelihoodsTree_().
|
inlineinherited |
Get the likelihood for each site.
Definition at line 221 of file LikelihoodCalculation.h.
References bpp::copyEigenToBpp(), and bpp::AlignedLikelihoodCalculation::getSiteLikelihoods().
|
inlineinherited |
Definition at line 209 of file LikelihoodCalculation.h.
References bpp::AlignedLikelihoodCalculation::getLikelihoodForASite(), and bpp::log().
|
inlineinherited |
Definition at line 165 of file LikelihoodCalculation.h.
References bpp::AlignedLikelihoodCalculation::makeLikelihoods(), bpp::AlignedLikelihoodCalculation::patternedSiteLikelihoods_, and bpp::AlignedLikelihoodCalculation::siteLikelihoods_.
Referenced by bpp::AlignedPhyloLikelihoodMixture::AlignedPhyloLikelihoodMixture(), and bpp::AlignedLikelihoodCalculation::getLikelihoodPerSite().
|
inline |
Definition at line 150 of file HmmLikelihood_DF.h.
References hiddenAlphabet_.
|
inline |
Definition at line 148 of file HmmLikelihood_DF.h.
References hiddenAlphabet_.
|
inlinevirtualinherited |
Definition at line 71 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::likelihood_.
Referenced by bpp::SubstitutionMappingTools::computeCounts(), bpp::SubstitutionMappingTools::computeNormalizations(), bpp::RewardMappingTools::computeRewardVectors(), bpp::OnABranchPhyloLikelihood::isInitialized(), bpp::OneProcessSequencePhyloLikelihood::isInitialized(), bpp::SingleProcessPhyloLikelihood::isInitialized(), and bpp::LikelihoodCalculationSingleProcess::setData().
|
inlinevirtual |
Reimplemented from bpp::AlignedLikelihoodCalculation.
Definition at line 145 of file HmmLikelihood_DF.h.
Definition at line 85 of file LikelihoodCalculation.h.
References bpp::LikelihoodCalculation::likelihood_.
Referenced by HmmLikelihood_DF(), bpp::LikelihoodCalculationOnABranch::makeLikelihoods(), and bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtRoot_().
|
virtual |
Reimplemented from bpp::AbstractParameterAliasable.
Definition at line 116 of file HmmLikelihood_DF.cpp.
References emissionProbabilities_, hiddenAlphabet_, matrix_, and bpp::AbstractParametrizable::setNamespace().
|
inline |
Definition at line 164 of file HmmLikelihood_DF.h.
References bpp::AbstractParameterAliasable::setParametersValues().
|
inlineinherited |
Definition at line 184 of file LikelihoodCalculation.h.
References bpp::AlignedLikelihoodCalculation::patternedSiteLikelihoods_, and bpp::AlignedLikelihoodCalculation::siteLikelihoods_.
Referenced by HmmLikelihood_DF(), bpp::LikelihoodCalculationOnABranch::makeLikelihoods(), and bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtRoot_().
|
protected |
DF Backward Likelihoods for sites per state
backwardLik_(i,j) corresponds to Pr(x_{j+1}...x_n | y_j=i)/Pr(x_{j+1}|x_1...x_j) where the x are the observed states, and y the hidden states.
Definition at line 95 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF().
|
private |
Definition at line 36 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF().
|
protected |
Definition at line 44 of file HmmLikelihood_DF.h.
Referenced by getHmmEmissionProbabilities(), HmmLikelihood_DF(), and setNamespace().
DF Conditional Likelihoods for sites:
Definition at line 84 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF().
|
protected |
The alphabet describing the hidden states.
Definition at line 43 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF(), hmmStateAlphabet(), and setNamespace().
|
protected |
Hidden Posterior Probabilities
hiddenPostProb_(i,j) corresponds to Pr(y_j=i | x_1...x_n) where the x are the observed states, and y the hidden states.
Definition at line 105 of file HmmLikelihood_DF.h.
Referenced by getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), and HmmLikelihood_DF().
DF Matrix from emission likelihoods for computation
Definition at line 77 of file HmmLikelihood_DF.h.
Referenced by getLikelihoodForASite(), and HmmLikelihood_DF().
|
protected |
DF equilibrium vector from transitionmatrix for computation
Definition at line 63 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF().
|
protected |
DF Matrix from transitionmatrix for computation
Definition at line 70 of file HmmLikelihood_DF.h.
Referenced by getHmmTransitionMatrix(), and HmmLikelihood_DF().
Likelihoods
Definition at line 30 of file LikelihoodCalculation.h.
Referenced by bpp::LikelihoodCalculation::cleanAllLikelihoods(), bpp::LikelihoodCalculation::getLikelihoodNode(), bpp::LikelihoodCalculation::getLikelihoodNode_(), bpp::LikelihoodCalculation::isInitialized(), bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtRoot_(), and bpp::LikelihoodCalculation::setLikelihoodNode().
|
protected |
DF TransitionMatrix
Definition at line 56 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF(), and setNamespace().
|
protected |
Definition at line 107 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF().
|
protected |
Definition at line 107 of file HmmLikelihood_DF.h.
Referenced by HmmLikelihood_DF().
|
mutableprotectedinherited |
Definition at line 155 of file LikelihoodCalculation.h.
Referenced by bpp::AlignedLikelihoodCalculation::cleanAllLikelihoods(), bpp::AlignedLikelihoodCalculation::getLikelihoodForASite(), bpp::AlignedLikelihoodCalculation::getSiteLikelihoods(), bpp::LikelihoodCalculationOnABranch::makeLikelihoods(), bpp::LikelihoodCalculationSingleProcess::makeLikelihoodsAtRoot_(), and bpp::AlignedLikelihoodCalculation::setSiteLikelihoods().
|
mutableprotectedinherited |
Site Likelihoods
Definition at line 149 of file LikelihoodCalculation.h.
Referenced by bpp::AlignedLikelihoodCalculation::cleanAllLikelihoods(), bpp::AlignedLikelihoodCalculation::getLikelihoodForASite(), bpp::AlignedLikelihoodCalculation::getSiteLikelihoods(), and bpp::AlignedLikelihoodCalculation::setSiteLikelihoods().