bpp-phyl3  3.0.0
bpp::HmmLikelihood_DF Class Reference

A simple implementation of hidden Markov models recursion, in DataFlow implementation. More...

#include <Bpp/Phyl/Likelihood/PhyloLikelihoods/HmmLikelihood_DF.h>

+ Inheritance diagram for bpp::HmmLikelihood_DF:
+ Collaboration diagram for bpp::HmmLikelihood_DF:

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_DFclone () const
 
void makeLikelihoods ()
 
const HmmStateAlphabethmmStateAlphabet () const
 
HmmStateAlphabethmmStateAlphabet ()
 
const Eigen::MatrixXd & getHmmTransitionMatrix () const
 
const HmmPhyloEmissionProbabilitiesgetHmmEmissionProbabilities () const
 
HmmPhyloEmissionProbabilitiesgetHmmEmissionProbabilities ()
 
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< DataLikgetLikelihoodNode ()
 
virtual bool isInitialized () const
 
const ContextgetContext () const
 
void setLikelihoodNode (ValueRef< DataLik > ll)
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () 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 ParameterListgetParameters () const override
 
const Parameterparameter (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 &parameters) override
 
void setParameterValue (const std::string &name, double value) override
 
void setParametersValues (const ParameterList &parameters) override
 
bool matchParametersValues (const ParameterList &parameters) 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 &parameters)
 

Protected Member Functions

ContextgetContext_ ()
 
ValueRef< DataLikgetLikelihoodNode_ ()
 
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 &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 

Protected Attributes

std::shared_ptr< HmmStateAlphabethiddenAlphabet_
 The alphabet describing the hidden states. More...
 
std::shared_ptr< HmmPhyloEmissionProbabilitiesemissionProbabilities_
 
std::shared_ptr< ConfiguredTransitionMatrixmatrix_
 
ValueRef< Eigen::VectorXd > hmmEq_
 
ValueRef< Eigen::MatrixXd > hmmTrans_
 
ValueRef< MatrixLikhmmEmis_
 
ValueRef< RowLikforwardLik_
 
ValueRef< Eigen::MatrixXd > backwardLik_
 
ValueRef< Eigen::MatrixXd > hiddenPostProb_
 
Eigen::Index nbStates_
 
Eigen::Index nbSites_
 
SiteLikelihoodsRef siteLikelihoods_
 
SiteLikelihoodsRef patternedSiteLikelihoods_
 
ValueRef< DataLiklikelihood_
 

Private Attributes

Contextcontext_
 
ParameterList independentParameters_
 
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
 
ParameterList parameters_
 
std::string prefix_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ HmmLikelihood_DF() [1/2]

◆ HmmLikelihood_DF() [2/2]

bpp::HmmLikelihood_DF::HmmLikelihood_DF ( const HmmLikelihood_DF lik)
inline

Definition at line 126 of file HmmLikelihood_DF.h.

◆ ~HmmLikelihood_DF()

virtual bpp::HmmLikelihood_DF::~HmmLikelihood_DF ( )
inlinevirtual

Definition at line 141 of file HmmLikelihood_DF.h.

Member Function Documentation

◆ cleanAllLikelihoods()

◆ clone()

HmmLikelihood_DF* bpp::HmmLikelihood_DF::clone ( ) const
inlinevirtual

Reimplemented from bpp::AlignedLikelihoodCalculation.

Definition at line 143 of file HmmLikelihood_DF.h.

References HmmLikelihood_DF().

◆ getContext()

const Context& bpp::LikelihoodCalculation::getContext ( ) const
inlineinherited

Definition at line 76 of file LikelihoodCalculation.h.

References bpp::LikelihoodCalculation::context_.

◆ getContext_()

◆ getHiddenStatesPosteriorProbabilities()

const Eigen::MatrixXd& bpp::HmmLikelihood_DF::getHiddenStatesPosteriorProbabilities ( ) const
inline

Definition at line 171 of file HmmLikelihood_DF.h.

References hiddenPostProb_.

◆ getHiddenStatesPosteriorProbabilitiesForASite()

Eigen::VectorXd bpp::HmmLikelihood_DF::getHiddenStatesPosteriorProbabilitiesForASite ( size_t  site) const
inline

Definition at line 176 of file HmmLikelihood_DF.h.

References hiddenPostProb_.

Referenced by getLikelihoodForASite().

◆ getHmmEmissionProbabilities() [1/2]

HmmPhyloEmissionProbabilities& bpp::HmmLikelihood_DF::getHmmEmissionProbabilities ( )
inline

Definition at line 162 of file HmmLikelihood_DF.h.

References emissionProbabilities_.

◆ getHmmEmissionProbabilities() [2/2]

const HmmPhyloEmissionProbabilities& bpp::HmmLikelihood_DF::getHmmEmissionProbabilities ( ) const
inline

Definition at line 160 of file HmmLikelihood_DF.h.

References emissionProbabilities_.

◆ getHmmTransitionMatrix()

const Eigen::MatrixXd& bpp::HmmLikelihood_DF::getHmmTransitionMatrix ( ) const
inline

Definition at line 158 of file HmmLikelihood_DF.h.

References hmmTrans_.

◆ getLikelihoodForASite() [1/2]

◆ getLikelihoodForASite() [2/2]

DataLik bpp::HmmLikelihood_DF::getLikelihoodForASite ( size_t  site) const
inline

◆ getLikelihoodNode()

ValueRef<DataLik> bpp::LikelihoodCalculation::getLikelihoodNode ( )
inlineinherited

◆ getLikelihoodNode_()

◆ getLikelihoodPerSite()

VDataLik bpp::AlignedLikelihoodCalculation::getLikelihoodPerSite ( )
inlineinherited

Get the likelihood for each site.

Returns
A vector with all site likelihoods.

Definition at line 221 of file LikelihoodCalculation.h.

References bpp::copyEigenToBpp(), and bpp::AlignedLikelihoodCalculation::getSiteLikelihoods().

◆ getLogLikelihoodForASite()

DataLik bpp::AlignedLikelihoodCalculation::getLogLikelihoodForASite ( size_t  pos,
bool  shrunk = false 
)
inlineinherited

◆ getSiteLikelihoods()

◆ hmmStateAlphabet() [1/2]

HmmStateAlphabet& bpp::HmmLikelihood_DF::hmmStateAlphabet ( )
inline

Definition at line 150 of file HmmLikelihood_DF.h.

References hiddenAlphabet_.

◆ hmmStateAlphabet() [2/2]

const HmmStateAlphabet& bpp::HmmLikelihood_DF::hmmStateAlphabet ( ) const
inline

Definition at line 148 of file HmmLikelihood_DF.h.

References hiddenAlphabet_.

◆ isInitialized()

◆ makeLikelihoods()

void bpp::HmmLikelihood_DF::makeLikelihoods ( )
inlinevirtual

Reimplemented from bpp::AlignedLikelihoodCalculation.

Definition at line 145 of file HmmLikelihood_DF.h.

◆ setLikelihoodNode()

void bpp::LikelihoodCalculation::setLikelihoodNode ( ValueRef< DataLik ll)
inlineinherited

◆ setNamespace()

void HmmLikelihood_DF::setNamespace ( const std::string &  nameSpace)
virtual

◆ setParameters()

void bpp::HmmLikelihood_DF::setParameters ( const ParameterList pl)
inline

◆ setSiteLikelihoods()

Member Data Documentation

◆ backwardLik_

ValueRef<Eigen::MatrixXd> bpp::HmmLikelihood_DF::backwardLik_
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().

◆ context_

Context& bpp::HmmLikelihood_DF::context_
private

Definition at line 36 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF().

◆ emissionProbabilities_

std::shared_ptr<HmmPhyloEmissionProbabilities> bpp::HmmLikelihood_DF::emissionProbabilities_
protected

Definition at line 44 of file HmmLikelihood_DF.h.

Referenced by getHmmEmissionProbabilities(), HmmLikelihood_DF(), and setNamespace().

◆ forwardLik_

ValueRef<RowLik> bpp::HmmLikelihood_DF::forwardLik_
protected

DF Conditional Likelihoods for sites:

Definition at line 84 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF().

◆ hiddenAlphabet_

std::shared_ptr<HmmStateAlphabet> bpp::HmmLikelihood_DF::hiddenAlphabet_
protected

The alphabet describing the hidden states.

Definition at line 43 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF(), hmmStateAlphabet(), and setNamespace().

◆ hiddenPostProb_

ValueRef<Eigen::MatrixXd> bpp::HmmLikelihood_DF::hiddenPostProb_
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().

◆ hmmEmis_

ValueRef<MatrixLik> bpp::HmmLikelihood_DF::hmmEmis_
protected

DF Matrix from emission likelihoods for computation

Definition at line 77 of file HmmLikelihood_DF.h.

Referenced by getLikelihoodForASite(), and HmmLikelihood_DF().

◆ hmmEq_

ValueRef<Eigen::VectorXd> bpp::HmmLikelihood_DF::hmmEq_
protected

DF equilibrium vector from transitionmatrix for computation

Definition at line 63 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF().

◆ hmmTrans_

ValueRef<Eigen::MatrixXd> bpp::HmmLikelihood_DF::hmmTrans_
protected

DF Matrix from transitionmatrix for computation

Definition at line 70 of file HmmLikelihood_DF.h.

Referenced by getHmmTransitionMatrix(), and HmmLikelihood_DF().

◆ likelihood_

◆ matrix_

std::shared_ptr<ConfiguredTransitionMatrix> bpp::HmmLikelihood_DF::matrix_
protected

DF TransitionMatrix

Definition at line 56 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF(), and setNamespace().

◆ nbSites_

Eigen::Index bpp::HmmLikelihood_DF::nbSites_
protected

Definition at line 107 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF().

◆ nbStates_

Eigen::Index bpp::HmmLikelihood_DF::nbStates_
protected

Definition at line 107 of file HmmLikelihood_DF.h.

Referenced by HmmLikelihood_DF().

◆ patternedSiteLikelihoods_

◆ siteLikelihoods_


The documentation for this class was generated from the following files: