bpp-core3
3.0.0
|
A simple implementation of hidden Markov models recursion. More...
#include <Bpp/Numeric/Hmm/RescaledHmmLikelihood.h>
Public Member Functions | |
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. More... | |
RescaledHmmLikelihood (const RescaledHmmLikelihood &lik) | |
RescaledHmmLikelihood & | operator= (const RescaledHmmLikelihood &lik) |
virtual | ~RescaledHmmLikelihood () |
RescaledHmmLikelihood * | clone () const override |
Create a copy of this object and send a pointer to it. More... | |
const HmmStateAlphabet & | hmmStateAlphabet () const override |
std::shared_ptr< const HmmStateAlphabet > | getHmmStateAlphabet () const override |
HmmStateAlphabet & | hmmStateAlphabet () override |
std::shared_ptr< HmmStateAlphabet > | getHmmStateAlphabet () override |
const HmmTransitionMatrix & | hmmTransitionMatrix () const override |
std::shared_ptr< const HmmTransitionMatrix > | getHmmTransitionMatrix () const override |
HmmTransitionMatrix & | hmmTransitionMatrix () override |
std::shared_ptr< HmmTransitionMatrix > | getHmmTransitionMatrix () override |
const HmmEmissionProbabilities & | hmmEmissionProbabilities () const override |
std::shared_ptr< const HmmEmissionProbabilities > | getHmmEmissionProbabilities () const override |
HmmEmissionProbabilities & | hmmEmissionProbabilities () override |
std::shared_ptr< HmmEmissionProbabilities > | getHmmEmissionProbabilities () override |
void | setBreakPoints (const std::vector< size_t > &breakPoints) override |
const std::vector< size_t > & | getBreakPoints () const override |
void | setParameters (const ParameterList &pl) override |
Set the point where the function must be computed. More... | |
double | getValue () const override |
Get the value of the function at the current point. More... | |
double | getLogLikelihood () const override |
double | getLikelihoodForASite (size_t site) const override |
Get the likelihood for a site, and its derivatives. More... | |
double | getDLogLikelihoodForASite (size_t site) const override |
double | getD2LogLikelihoodForASite (size_t site) const override |
Vdouble | getLikelihoodForEachSite () const override |
Get the likelihood for each site. More... | |
void | setNamespace (const std::string &nameSpace) override |
Set the namespace for the parameter names. More... | |
void | fireParameterChanged (const ParameterList &pl) override |
Notify the class when one or several parameters have changed. More... | |
Vdouble | getHiddenStatesPosteriorProbabilitiesForASite (size_t site) const override |
void | getHiddenStatesPosteriorProbabilities (std::vector< std::vector< double >> &probs, bool append=false) const override |
virtual double | d2f (const std::string &variable, const ParameterList ¶meters) |
Get the value of the second order derivative of the function according to a given set of parameters. More... | |
virtual double | d2f (const std::string &variable1, const std::string &variable2, const ParameterList ¶meters) |
Get the value of the cross derivative of the function according to a given set of parameters. More... | |
virtual double | df (const std::string &variable, const ParameterList ¶meters) |
Get the value of the first derivative of the function according to a given set of parameters. More... | |
virtual double | f (const ParameterList ¶meters) |
Get the value of the function according to a given set of parameters. More... | |
virtual bool | hasParameter (const std::string &name) const =0 |
Tell if there is a parameter with specified name. More... | |
virtual const ParameterList & | getParameters () const =0 |
Get all parameters available. More... | |
virtual const Parameter & | parameter (const std::string &name) const =0 |
Get the parameter with specified name. More... | |
virtual double | getParameterValue (const std::string &name) const =0 |
Get the value for parameter of name 'name'. More... | |
virtual void | setAllParametersValues (const ParameterList ¶meters)=0 |
Set the parameters values to be equals to those of parameters. More... | |
virtual void | setParameterValue (const std::string &name, double value)=0 |
Set the value of parameter with name name to be equal to value. More... | |
virtual void | setParametersValues (const ParameterList ¶meters)=0 |
Update the parameters from parameters. More... | |
virtual bool | matchParametersValues (const ParameterList ¶meters)=0 |
Update the parameters from parameters. More... | |
virtual void | removeConstraint (const std::string &name)=0 |
Remove the constraint associated with one parameter, if any. More... | |
virtual void | setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint)=0 |
Set/Change the constraint associated with one parameter. More... | |
virtual size_t | getNumberOfParameters () const =0 |
Get the number of parameters. More... | |
virtual std::string | getNamespace () const =0 |
virtual std::string | getParameterNameWithoutNamespace (const std::string &name) const =0 |
Resolves a parameter name according to the current namespace. More... | |
bool | hasParameter (const std::string &name) const override |
Tell if there is a parameter with specified name. More... | |
const ParameterList & | getParameters () const override |
Get all parameters available. More... | |
const Parameter & | parameter (const std::string &name) const override |
Get the parameter with specified name. More... | |
const std::shared_ptr< Parameter > & | getParameter (const std::string &name) const |
double | getParameterValue (const std::string &name) const override |
Get the value for parameter of name 'name'. More... | |
void | setAllParametersValues (const ParameterList ¶meters) override |
Set the parameters values to be equals to those of parameters. More... | |
void | setParameterValue (const std::string &name, double value) override |
Set the value of parameter with name name to be equal to value. More... | |
void | setParametersValues (const ParameterList ¶meters) override |
Update the parameters from parameters. More... | |
bool | matchParametersValues (const ParameterList ¶meters) override |
Update the parameters from parameters. More... | |
void | removeConstraint (const std::string &name) override |
Remove the constraint associated with one parameter, if any. More... | |
void | setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override |
Set/Change the constraint associated with one parameter. More... | |
size_t | getNumberOfParameters () const override |
Get the number of parameters. More... | |
std::string | getNamespace () const override |
std::string | getParameterNameWithoutNamespace (const std::string &name) const override |
Resolves a parameter name according to the current namespace. More... | |
void | enableFirstOrderDerivatives (bool yn) |
From FirstOrder: More... | |
bool | enableFirstOrderDerivatives () const |
Tell if derivatives must be computed. More... | |
double | getFirstOrderDerivative (const std::string &variable) const |
Get the derivative of the function at the current point. More... | |
double | getDLogLikelihood () const |
void | enableSecondOrderDerivatives (bool yn) |
From SecondOrder: More... | |
bool | enableSecondOrderDerivatives () const |
Tell if derivatives must be computed. More... | |
double | getSecondOrderDerivative (const std::string &variable) const |
Get the second order derivative of the function at the current point. More... | |
double | getSecondOrderDerivative (const std::string &variable1, const std::string &variable2) const |
Get the value of the cross derivative of the function according to a given set of parameters. More... | |
double | getD2LogLikelihood () const |
Protected Member Functions | |
void | computeForward_ () |
void | computeBackward_ () const |
void | computeDLikelihood_ () const override |
void | computeD2Likelihood_ () const override |
void | computeDForward_ () const |
void | computeD2Forward_ () const |
virtual ParameterList & | getParameters_ ()=0 |
Get all parameters available. More... | |
const std::shared_ptr< Parameter > & | getParameter (size_t i) const |
std::shared_ptr< Parameter > & | getParameter (size_t i) |
virtual void | addParameter_ (Parameter *parameter) |
virtual void | addParameters_ (const ParameterList ¶meters) |
virtual void | shareParameter_ (const std::shared_ptr< Parameter > ¶meter) |
virtual void | shareParameters_ (const ParameterList ¶meters) |
virtual void | includeParameters_ (const ParameterList ¶meters) |
virtual void | deleteParameter_ (size_t index) |
virtual void | deleteParameter_ (std::string &name) |
virtual 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 |
Get all parameters available. More... | |
Protected Attributes | |
double | dLogLik_ |
std::string | dVariable_ |
double | d2LogLik_ |
std::string | d2Variable_ |
Private Attributes | |
std::shared_ptr< HmmStateAlphabet > | hiddenAlphabet_ |
The alphabet describing the hidden states. More... | |
std::shared_ptr< HmmTransitionMatrix > | transitionMatrix_ |
std::shared_ptr< HmmEmissionProbabilities > | emissionProbabilities_ |
std::vector< double > | likelihood_ |
The likelihood arrays. More... | |
std::vector< std::vector< double > > | dLikelihood_ |
derivatec of forward likelihood More... | |
std::vector< std::vector< double > > | d2Likelihood_ |
std::vector< std::vector< double > > | backLikelihood_ |
backward likelihood More... | |
bool | backLikelihoodUpToDate_ |
std::vector< double > | scales_ |
scales for likelihood computing More... | |
std::vector< double > | dScales_ |
std::vector< double > | d2Scales_ |
double | logLik_ |
std::vector< size_t > | breakPoints_ |
size_t | nbStates_ |
size_t | nbSites_ |
A simple implementation of hidden Markov models recursion.
This implementation uses the rescaling method described in Durbin et al "Biological sequence analysis", Cambridge University Press. It also offer the possibility to specify "breakpoints", where the chain will be reset to the equilibrium frequencies.
Definition at line 25 of file RescaledHmmLikelihood.h.
RescaledHmmLikelihood::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.
Definition at line 14 of file RescaledHmmLikelihood.cpp.
References bpp::AbstractParametrizable::addParameters_(), computeForward_(), emissionProbabilities_, hiddenAlphabet_, likelihood_, nbSites_, nbStates_, scales_, and transitionMatrix_.
Referenced by clone().
|
inline |
Definition at line 103 of file RescaledHmmLikelihood.h.
|
inlinevirtual |
Definition at line 153 of file RescaledHmmLikelihood.h.
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 111 of file AbstractParametrizable.h.
References bpp::ParameterList::addParameter().
Referenced by bpp::AbstractParameterAliasable::addParameter_(), and bpp::AutoCorrelationTransitionMatrix::AutoCorrelationTransitionMatrix().
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 117 of file AbstractParametrizable.h.
References bpp::ParameterList::addParameters().
Referenced by bpp::AbstractParameterAliasable::addParameters_(), bpp::FullHmmTransitionMatrix::FullHmmTransitionMatrix(), bpp::LogsumHmmLikelihood::LogsumHmmLikelihood(), bpp::LowMemoryRescaledHmmLikelihood::LowMemoryRescaledHmmLikelihood(), and RescaledHmmLikelihood().
|
inlineoverridevirtual |
Create a copy of this object and send a pointer to it.
Implements bpp::HmmLikelihood.
Definition at line 155 of file RescaledHmmLikelihood.h.
References RescaledHmmLikelihood().
|
protected |
Definition at line 224 of file RescaledHmmLikelihood.cpp.
References backLikelihood_, backLikelihoodUpToDate_, breakPoints_, nbSites_, nbStates_, scales_, and transitionMatrix_.
Referenced by getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), and getLogLikelihood().
|
protected |
Definition at line 486 of file RescaledHmmLikelihood.cpp.
References breakPoints_, d2Likelihood_, bpp::AbstractHmmLikelihood::d2LogLik_, d2Scales_, dLikelihood_, bpp::AbstractHmmLikelihood::dLogLik_, dScales_, emissionProbabilities_, likelihood_, nbSites_, nbStates_, scales_, bpp::VectorTools::sum(), and transitionMatrix_.
Referenced by computeD2Likelihood_().
|
inlineoverrideprotectedvirtual |
Implements bpp::HmmLikelihood.
Definition at line 220 of file RescaledHmmLikelihood.h.
References computeD2Forward_(), and computeDForward_().
|
protected |
Definition at line 370 of file RescaledHmmLikelihood.cpp.
References breakPoints_, dLikelihood_, bpp::AbstractHmmLikelihood::dLogLik_, dScales_, emissionProbabilities_, likelihood_, nbSites_, nbStates_, scales_, bpp::VectorTools::sum(), and transitionMatrix_.
Referenced by computeD2Likelihood_(), and computeDLikelihood_().
|
inlineoverrideprotectedvirtual |
Implements bpp::HmmLikelihood.
Definition at line 215 of file RescaledHmmLikelihood.h.
References computeDForward_().
|
protected |
Definition at line 92 of file RescaledHmmLikelihood.cpp.
References breakPoints_, likelihood_, logLik_, nbSites_, nbStates_, scales_, bpp::TextTools::toString(), transitionMatrix_, and bpp::ApplicationTools::warning.
Referenced by fireParameterChanged(), getLogLikelihood(), RescaledHmmLikelihood(), and setBreakPoints().
|
inlinevirtualinherited |
Get the value of the second order derivative of the function according to a given set of parameters.
variable | The name of the variable in . |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 193 of file Functions.h.
References bpp::FunctionInterface::setParameters().
|
inlinevirtualinherited |
Get the value of the cross derivative of the function according to a given set of parameters.
variable1 | The name of the variable in . |
variable2 | The name of the variable in . |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 220 of file Functions.h.
References bpp::FunctionInterface::setParameters().
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 137 of file AbstractParametrizable.h.
References bpp::ParameterList::deleteParameter(), and bpp::ParameterList::size().
Referenced by bpp::AbstractParameterAliasable::deleteParameter_().
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 144 of file AbstractParametrizable.h.
References bpp::ParameterList::deleteParameter().
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 149 of file AbstractParametrizable.h.
References bpp::ParameterList::deleteParameters().
|
inlinevirtualinherited |
Get the value of the first derivative of the function according to a given set of parameters.
variable | The name of the variable in . |
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Definition at line 138 of file Functions.h.
References bpp::FunctionInterface::setParameters().
|
inlinevirtualinherited |
From FirstOrder:
Implements bpp::FirstOrderDerivable.
Definition at line 132 of file HmmLikelihood.h.
|
inlinevirtualinherited |
Tell if derivatives must be computed.
Implements bpp::FirstOrderDerivable.
Definition at line 134 of file HmmLikelihood.h.
References bpp::FirstOrderDerivable::getFirstOrderDerivative().
|
inlinevirtualinherited |
From SecondOrder:
Implements bpp::SecondOrderDerivable.
Definition at line 152 of file HmmLikelihood.h.
|
inlinevirtualinherited |
Tell if derivatives must be computed.
Implements bpp::SecondOrderDerivable.
Definition at line 154 of file HmmLikelihood.h.
References bpp::SecondOrderDerivable::getSecondOrderDerivative().
|
inlinevirtualinherited |
Get the value of the function according to a given set of parameters.
parameters | The parameter set to pass to the function. |
Exception | If an error occured. |
Reimplemented in bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, and bpp::AbstractNumericalDerivative.
Definition at line 82 of file Functions.h.
References bpp::FunctionInterface::getValue(), and bpp::FunctionInterface::setParameters().
Referenced by bpp::NumTools::uniRoot().
|
overridevirtual |
Notify the class when one or several parameters have changed.
parameters | A ParameterList object with parameters that changed. |
Reimplemented from bpp::AbstractParametrizable.
Definition at line 73 of file RescaledHmmLikelihood.cpp.
References backLikelihoodUpToDate_, computeForward_(), emissionProbabilities_, hiddenAlphabet_, and transitionMatrix_.
Referenced by getLogLikelihood().
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 183 of file RescaledHmmLikelihood.h.
References breakPoints_.
|
inlinevirtualinherited |
Implements bpp::HmmLikelihood.
Definition at line 158 of file HmmLikelihood.h.
|
overridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 603 of file RescaledHmmLikelihood.cpp.
References d2Scales_, dScales_, and scales_.
Referenced by getLogLikelihood().
|
inlinevirtualinherited |
Implements bpp::HmmLikelihood.
Definition at line 138 of file HmmLikelihood.h.
|
overridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 478 of file RescaledHmmLikelihood.cpp.
References dScales_, and scales_.
Referenced by getLogLikelihood().
|
virtualinherited |
Get the derivative of the function at the current point.
variable | The name of the variable in . |
Exception | If no point is specified or if an error occured. |
Implements bpp::FirstOrderDerivable.
Definition at line 33 of file HmmLikelihood.cpp.
References bpp::HmmEmissionProbabilities::computeDEmissionProbabilities(), bpp::HmmLikelihood::computeDLikelihood_(), bpp::AbstractHmmLikelihood::dLogLik_, bpp::AbstractHmmLikelihood::dVariable_, and bpp::HmmLikelihood::hmmEmissionProbabilities().
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_().
|
overridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 346 of file RescaledHmmLikelihood.cpp.
References backLikelihood_, backLikelihoodUpToDate_, computeBackward_(), likelihood_, nbSites_, and nbStates_.
Referenced by getLikelihoodForEachSite(), and getLogLikelihood().
|
overridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 330 of file RescaledHmmLikelihood.cpp.
References backLikelihood_, backLikelihoodUpToDate_, computeBackward_(), likelihood_, and nbStates_.
Referenced by getLikelihoodForASite(), and getLogLikelihood().
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 171 of file RescaledHmmLikelihood.h.
References emissionProbabilities_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 174 of file RescaledHmmLikelihood.h.
References emissionProbabilities_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 159 of file RescaledHmmLikelihood.h.
References hiddenAlphabet_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 162 of file RescaledHmmLikelihood.h.
References hiddenAlphabet_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 165 of file RescaledHmmLikelihood.h.
References transitionMatrix_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 168 of file RescaledHmmLikelihood.h.
References transitionMatrix_.
|
overridevirtual |
Get the likelihood for a site, and its derivatives.
site | The site index to analyse. |
Implements bpp::HmmLikelihood.
Definition at line 298 of file RescaledHmmLikelihood.cpp.
References getHiddenStatesPosteriorProbabilitiesForASite(), and nbStates_.
Referenced by getLogLikelihood().
|
overridevirtual |
Get the likelihood for each site.
Implements bpp::HmmLikelihood.
Definition at line 310 of file RescaledHmmLikelihood.cpp.
References getHiddenStatesPosteriorProbabilities(), nbSites_, and nbStates_.
Referenced by getLogLikelihood().
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 192 of file RescaledHmmLikelihood.h.
References computeBackward_(), computeForward_(), fireParameterChanged(), getD2LogLikelihoodForASite(), getDLogLikelihoodForASite(), getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), getLikelihoodForASite(), getLikelihoodForEachSite(), logLik_, and setNamespace().
|
inlineoverridevirtualinherited |
Implements bpp::Parametrizable.
Definition at line 99 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::getParameterNameWithoutNamespace(), and bpp::AbstractParametrizable::prefix_.
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::MixtureOfDiscreteDistributions::MixtureOfDiscreteDistributions(), bpp::Simplex::setFrequencies(), and bpp::AbstractParameterAliasable::setNamespace().
|
pure virtualinherited |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineoverridevirtualinherited |
Get the number of parameters.
Implements bpp::Parametrizable.
Definition at line 95 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::setNamespace(), and bpp::ParameterList::size().
Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParameterAliasable::aliasParameters(), bpp::SimpleDiscreteDistribution::fireParameterChanged(), bpp::AbstractParameterAliasable::operator=(), bpp::ConstantDistribution::restrictToConstraint(), and bpp::SimpleDiscreteDistribution::restrictToConstraint().
|
pure virtualinherited |
Get the number of parameters.
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, bpp::AbstractParametrizable, and bpp::DirectionFunction.
Referenced by bpp::BppODiscreteDistributionFormat::writeDiscreteDistribution(), and bpp::Parametrizable::~Parametrizable().
|
inlineinherited |
Definition at line 48 of file AbstractParametrizable.h.
References bpp::ParameterList::getParameter().
Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParameterAliasable::operator=(), and bpp::AbstractParameterAliasable::unaliasParameters().
|
inlineprotectedinherited |
Definition at line 211 of file AbstractParametrizable.h.
References bpp::ParameterList::getParameter().
|
inlineprotectedinherited |
Definition at line 216 of file AbstractParametrizable.h.
References bpp::ParameterList::getParameter().
|
inlineprotectedinherited |
name | The name of the parameter. |
ParameterNotFoundException | If no parameter with that name is found in the list. |
Definition at line 164 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::hasParameter(), and bpp::ParameterList::parameter().
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::AbstractParametrizable::getParameterWithNamespace_(), bpp::AbstractParametrizable::removeConstraint(), bpp::ConstantDistribution::restrictToConstraint(), bpp::TruncatedExponentialDiscreteDistribution::restrictToConstraint(), bpp::SimpleDiscreteDistribution::restrictToConstraint(), bpp::InvariantMixedDiscreteDistribution::restrictToConstraint(), bpp::AbstractParametrizable::setConstraint(), and bpp::AbstractParameterAliasable::unaliasParameters().
|
inlineprotectedinherited |
Definition at line 190 of file AbstractParametrizable.h.
References bpp::ParameterList::size().
|
inlineprotectedinherited |
Definition at line 197 of file AbstractParametrizable.h.
References bpp::ParameterList::size().
|
overridevirtualinherited |
Resolves a parameter name according to the current namespace.
Implements bpp::Parametrizable.
Definition at line 28 of file AbstractParametrizable.cpp.
References bpp::TextTools::startsWith().
Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParametrizable::getNamespace(), and bpp::AbstractParameterAliasable::operator=().
|
pure virtualinherited |
Resolves a parameter name according to the current namespace.
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::BppODiscreteDistributionFormat::readDiscreteDistribution(), bpp::BppOParametrizableFormat::write(), and bpp::Parametrizable::~Parametrizable().
|
inlineoverridevirtualinherited |
Get all parameters available.
Implements bpp::Parametrizable.
Definition at line 41 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::parameters_.
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::FullHmmTransitionMatrix::FullHmmTransitionMatrix(), bpp::MixtureOfDiscreteDistributions::MixtureOfDiscreteDistributions(), and bpp::ParametrizableCollection< N >::removeObject().
|
pure virtualinherited |
Get all parameters available.
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, bpp::DirectionFunction, and bpp::AbstractParametrizable.
Referenced by bpp::ParameterAliasableAdapter::getIndependentParameters(), bpp::BppODiscreteDistributionFormat::readDiscreteDistribution(), bpp::BppOParametrizableFormat::write(), and bpp::Parametrizable::~Parametrizable().
|
protectedpure virtualinherited |
Get all parameters available.
Implemented in bpp::FunctionWrapper, bpp::AbstractParametrizable, and bpp::DirectionFunction.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineoverrideprotectedvirtualinherited |
Get all parameters available.
Implements bpp::Parametrizable.
Definition at line 205 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::parameters_.
Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParameterAliasable::aliasParameters(), and bpp::AbstractParameterAliasable::operator=().
|
inlineoverridevirtualinherited |
Get the value for parameter of name 'name'.
name | The name of the parameter. |
Implements bpp::Parametrizable.
Definition at line 53 of file AbstractParametrizable.h.
References bpp::Parameter::getValue(), and bpp::AbstractParametrizable::parameter().
Referenced by bpp::DirichletDiscreteDistribution::applyParameters(), bpp::ConstantDistribution::fireParameterChanged(), bpp::GaussianDiscreteDistribution::fireParameterChanged(), bpp::BetaDiscreteDistribution::fireParameterChanged(), bpp::ExponentialDiscreteDistribution::fireParameterChanged(), bpp::InvariantMixedDiscreteDistribution::fireParameterChanged(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::AutoCorrelationTransitionMatrix::fireParameterChanged(), bpp::TruncatedExponentialDiscreteDistribution::fireParameterChanged(), bpp::SimpleDiscreteDistribution::fireParameterChanged(), bpp::MixtureOfDiscreteDistributions::fireParameterChanged(), bpp::Simplex::fireParameterChanged(), bpp::BetaDiscreteDistribution::randC(), bpp::ExponentialDiscreteDistribution::randC(), bpp::GammaDiscreteDistribution::randC(), bpp::TruncatedExponentialDiscreteDistribution::randC(), and bpp::ConstantDistribution::restrictToConstraint().
|
pure virtualinherited |
Get the value for parameter of name 'name'.
name | The name of the parameter. |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::BppODiscreteDistributionFormat::readDiscreteDistribution(), and bpp::Parametrizable::~Parametrizable().
|
inlineprotectedinherited |
name | The name of the parameter, including its namespace. |
ParameterNotFoundException | If no parameter with that name is found in the list. |
Definition at line 176 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::getParameter_().
|
inlineprotectedinherited |
name | The name of the parameter, including its namespace. |
ParameterNotFoundException | If no parameter with that name is found in the list. |
Definition at line 185 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::parameter().
|
virtualinherited |
Get the second order derivative of the function at the current point.
variable | The name of the variable in . |
Exception | If no point is specified or if an error occured. |
Implements bpp::SecondOrderDerivable.
Definition at line 45 of file HmmLikelihood.cpp.
References bpp::HmmEmissionProbabilities::computeD2EmissionProbabilities(), bpp::HmmLikelihood::computeD2Likelihood_(), bpp::AbstractHmmLikelihood::d2LogLik_, bpp::AbstractHmmLikelihood::d2Variable_, and bpp::HmmLikelihood::hmmEmissionProbabilities().
|
inlinevirtualinherited |
Get the value of the cross derivative of the function according to a given set of parameters.
variable1 | The name of the variable in . |
variable2 | The name of the variable in . |
Exception | If an error occured. |
Implements bpp::SecondOrderDerivable.
Definition at line 163 of file HmmLikelihood.h.
|
inlineoverridevirtual |
Get the value of the function at the current point.
Exception | If no point is specified or if an error occured. |
Implements bpp::FunctionInterface.
Definition at line 190 of file RescaledHmmLikelihood.h.
References logLik_.
|
pure virtualinherited |
Tell if there is a parameter with specified name.
name | The name of the parameter to look for. |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineoverridevirtualinherited |
Tell if there is a parameter with specified name.
name | The name of the parameter to look for. |
Implements bpp::Parametrizable.
Definition at line 39 of file AbstractParametrizable.h.
References bpp::ParameterList::hasParameter().
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::AbstractParametrizable::getParameter_(), and bpp::AbstractParameterAliasable::unaliasParameters().
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 170 of file RescaledHmmLikelihood.h.
References emissionProbabilities_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 173 of file RescaledHmmLikelihood.h.
References emissionProbabilities_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 158 of file RescaledHmmLikelihood.h.
References hiddenAlphabet_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 161 of file RescaledHmmLikelihood.h.
References hiddenAlphabet_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 164 of file RescaledHmmLikelihood.h.
References transitionMatrix_.
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 167 of file RescaledHmmLikelihood.h.
References transitionMatrix_.
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 132 of file AbstractParametrizable.h.
References bpp::ParameterList::includeParameters().
Referenced by bpp::AbstractParameterAliasable::includeParameters_().
|
inlineoverridevirtualinherited |
Update the parameters from parameters.
Only common parameters with parameters will be updated.
parameters | A list of parameters. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implements bpp::Parametrizable.
Definition at line 76 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::fireParameterChanged(), bpp::ParameterList::matchParametersValues(), and bpp::ParameterList::shareSubList().
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::Simplex::setFrequencies(), bpp::ReparametrizationFunctionWrapper::setParameters(), and bpp::FullHmmTransitionMatrix::setTransitionProbabilities().
|
pure virtualinherited |
Update the parameters from parameters.
Only common parameters with parameters will be updated.
parameters | A list of parameters. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implemented in bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::BppODiscreteDistributionFormat::initialize_(), bpp::TestFunction::setParameters(), and bpp::Parametrizable::~Parametrizable().
|
inline |
Definition at line 127 of file RescaledHmmLikelihood.h.
References backLikelihood_, backLikelihoodUpToDate_, breakPoints_, d2Likelihood_, d2Scales_, dLikelihood_, dScales_, emissionProbabilities_, hiddenAlphabet_, likelihood_, logLik_, nbSites_, nbStates_, bpp::AbstractHmmLikelihood::operator=(), scales_, and transitionMatrix_.
|
inlineoverridevirtualinherited |
Get the parameter with specified name.
name | The name of the parameter to look for. |
ParameterNotFoundException | if no parameter with this name is found. |
Implements bpp::Parametrizable.
Definition at line 43 of file AbstractParametrizable.h.
References bpp::ParameterList::parameter().
Referenced by bpp::AbstractParameterAliasable::getAliasedParameters(), bpp::ReparametrizationDerivableFirstOrderWrapper::getFirstOrderDerivative(), bpp::AbstractParameterAliasable::getFromParameters(), bpp::AbstractParametrizable::getParameterValue(), bpp::AbstractParametrizable::getParameterWithNamespace_(), and bpp::ReparametrizationDerivableSecondOrderWrapper::getSecondOrderDerivative().
|
pure virtualinherited |
Get the parameter with specified name.
name | The name of the parameter to look for. |
ParameterNotFoundException | if no parameter with this name is found. |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::TestFunction::getValue(), and bpp::Parametrizable::~Parametrizable().
|
inlineoverridevirtualinherited |
Remove the constraint associated with one parameter, if any.
name | The name of the parameter to look for. |
ParameterNotFoundException | if no parameter with this name is found. |
Implements bpp::Parametrizable.
Definition at line 85 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::removeConstraint().
|
pure virtualinherited |
Remove the constraint associated with one parameter, if any.
name | The name of the parameter to look for. |
ParameterNotFoundException | if no parameter with this name is found. |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineprotectedinherited |
Definition at line 154 of file AbstractParametrizable.h.
References bpp::ParameterList::reset().
Referenced by bpp::AbstractParameterAliasable::resetParameters_().
|
inlineoverridevirtualinherited |
Set the parameters values to be equals to those of parameters.
The list must contain exactly the same parameters (ie same names) than the parameters available.
parameters | A list with all parameters. |
ParameterNotFoundException | If a some parameter in the list is not in params. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implements bpp::Parametrizable.
Definition at line 58 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setAllParametersValues().
|
pure virtualinherited |
Set the parameters values to be equals to those of parameters.
The list must contain exactly the same parameters (ie same names) than the parameters available.
parameters | A list with all parameters. |
ParameterNotFoundException | If a some parameter in the list is not in params. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implemented in bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineoverridevirtual |
Implements bpp::HmmLikelihood.
Definition at line 176 of file RescaledHmmLikelihood.h.
References computeForward_().
|
inlineoverridevirtualinherited |
Set/Change the constraint associated with one parameter.
name | The name of the parameter to look for. |
constraint | A pointer to the constraint (may be null) |
ParameterNotFoundException | if no parameter with this name is found. |
Implements bpp::Parametrizable.
Definition at line 90 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::setConstraint().
Referenced by bpp::SimpleDiscreteDistribution::restrictToConstraint().
|
pure virtualinherited |
Set/Change the constraint associated with one parameter.
name | The name of the parameter to look for. |
constraint | A pointer to the constraint (may be null) |
ParameterNotFoundException | if no parameter with this name is found. |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
overridevirtual |
Set the namespace for the parameter names.
prefix | The 'namespace', that is a prefix to add to all parameter names. If parameter names are already prefixed, the new prefix will be used instead. |
Reimplemented from bpp::AbstractParametrizable.
Definition at line 64 of file RescaledHmmLikelihood.cpp.
References emissionProbabilities_, hiddenAlphabet_, bpp::AbstractParametrizable::setNamespace(), and transitionMatrix_.
Referenced by getLogLikelihood().
|
inlineoverridevirtual |
Set the point where the function must be computed.
parameters | The parameter set to pass to the function. |
Implements bpp::FunctionInterface.
Definition at line 185 of file RescaledHmmLikelihood.h.
References bpp::AbstractParametrizable::setParametersValues().
|
inlineoverridevirtualinherited |
Update the parameters from parameters.
parameters must be a subset of all parameters available.
parameters | A list containing all parameters to update. |
ParameterNotFoundException | If a some parameter in params is not in the list. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implements bpp::Parametrizable.
Definition at line 70 of file AbstractParametrizable.h.
References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParametersValues().
Referenced by bpp::LowMemoryRescaledHmmLikelihood::setParameters(), setParameters(), and bpp::LogsumHmmLikelihood::setParameters().
|
pure virtualinherited |
Update the parameters from parameters.
parameters must be a subset of all parameters available.
parameters | A list containing all parameters to update. |
ParameterNotFoundException | If a some parameter in params is not in the list. |
ConstraintException | If a value in parameters does not match the constraint in the corresponding parameter in the list. |
Implemented in bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineoverridevirtualinherited |
Set the value of parameter with name name to be equal to value.
name | the name of the parameter to set. |
value | The value of the parameter. |
ParameterNotFoundException | If no parameter in the list has the name name. |
ConstraintException | If value does not match the constraint associated to parameter name. |
Implements bpp::Parametrizable.
Definition at line 64 of file AbstractParametrizable.h.
References bpp::ParameterList::createSubList(), bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParameterValue().
|
pure virtualinherited |
Set the value of parameter with name name to be equal to value.
name | the name of the parameter to set. |
value | The value of the parameter. |
ParameterNotFoundException | If no parameter in the list has the name name. |
ConstraintException | If value does not match the constraint associated to parameter name. |
Implemented in bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 122 of file AbstractParametrizable.h.
References bpp::ParameterList::shareParameter().
Referenced by bpp::AbstractParameterAliasable::shareParameter_().
|
inlineprotectedvirtualinherited |
Reimplemented in bpp::AbstractParameterAliasable.
Definition at line 127 of file AbstractParametrizable.h.
References bpp::ParameterList::shareParameters().
Referenced by bpp::AbstractParameterAliasable::shareParameters_().
|
mutableprivate |
backward likelihood
backLikelihood_[i][j] corresponds to Pr(x_i+1...x_n | yi=j), where the x are the observed states, and y the hidden states.
Definition at line 68 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), and operator=().
|
mutableprivate |
Definition at line 69 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), fireParameterChanged(), getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), and operator=().
|
private |
Definition at line 84 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), computeD2Forward_(), computeDForward_(), computeForward_(), getBreakPoints(), and operator=().
|
mutableprivate |
Definition at line 59 of file RescaledHmmLikelihood.h.
Referenced by computeD2Forward_(), and operator=().
|
mutableprotectedinherited |
Definition at line 116 of file HmmLikelihood.h.
Referenced by computeD2Forward_(), bpp::LogsumHmmLikelihood::computeD2Forward_(), bpp::AbstractHmmLikelihood::getSecondOrderDerivative(), and bpp::AbstractHmmLikelihood::operator=().
|
mutableprivate |
Definition at line 81 of file RescaledHmmLikelihood.h.
Referenced by computeD2Forward_(), getD2LogLikelihoodForASite(), and operator=().
|
mutableprotectedinherited |
Definition at line 117 of file HmmLikelihood.h.
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_(), bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::AbstractHmmLikelihood::getSecondOrderDerivative(), and bpp::AbstractHmmLikelihood::operator=().
|
mutableprivate |
derivatec of forward likelihood
dlikelihood_[i][j] corresponds to d(Pr(x_1...x_i, y_i=j))/Pr(x_1...x_i)), where the x are the observed states, and y the hidden states.
Definition at line 58 of file RescaledHmmLikelihood.h.
Referenced by computeD2Forward_(), computeDForward_(), and operator=().
|
mutableprotectedinherited |
Definition at line 113 of file HmmLikelihood.h.
Referenced by computeD2Forward_(), computeDForward_(), bpp::LogsumHmmLikelihood::computeDForward_(), bpp::AbstractHmmLikelihood::getFirstOrderDerivative(), and bpp::AbstractHmmLikelihood::operator=().
|
mutableprivate |
Definition at line 80 of file RescaledHmmLikelihood.h.
Referenced by computeD2Forward_(), computeDForward_(), getD2LogLikelihoodForASite(), getDLogLikelihoodForASite(), and operator=().
|
mutableprotectedinherited |
Definition at line 114 of file HmmLikelihood.h.
Referenced by bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::AbstractHmmLikelihood::getFirstOrderDerivative(), and bpp::AbstractHmmLikelihood::operator=().
|
private |
Definition at line 35 of file RescaledHmmLikelihood.h.
Referenced by computeD2Forward_(), computeDForward_(), fireParameterChanged(), getHmmEmissionProbabilities(), hmmEmissionProbabilities(), operator=(), RescaledHmmLikelihood(), and setNamespace().
|
private |
The alphabet describing the hidden states.
Definition at line 33 of file RescaledHmmLikelihood.h.
Referenced by fireParameterChanged(), getHmmStateAlphabet(), hmmStateAlphabet(), operator=(), RescaledHmmLikelihood(), and setNamespace().
|
private |
The likelihood arrays.
forward likelihood
likelihood_[i * nbStates_ + j] corresponds to Pr(x_1...x_i, y_i=j)/Pr(x_1...x_i), where the x are the observed states, and y the hidden states.
Definition at line 49 of file RescaledHmmLikelihood.h.
Referenced by computeD2Forward_(), computeDForward_(), computeForward_(), getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), operator=(), and RescaledHmmLikelihood().
|
private |
Definition at line 82 of file RescaledHmmLikelihood.h.
Referenced by computeForward_(), getLogLikelihood(), getValue(), and operator=().
|
private |
Definition at line 86 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), computeD2Forward_(), computeDForward_(), computeForward_(), getHiddenStatesPosteriorProbabilities(), getLikelihoodForEachSite(), operator=(), and RescaledHmmLikelihood().
|
private |
Definition at line 86 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), computeD2Forward_(), computeDForward_(), computeForward_(), getHiddenStatesPosteriorProbabilities(), getHiddenStatesPosteriorProbabilitiesForASite(), getLikelihoodForASite(), getLikelihoodForEachSite(), operator=(), and RescaledHmmLikelihood().
|
private |
scales for likelihood computing
scales_[i * nbStates_ + j] corresponds to Pr(x_1...x_i)/Pr(x_1...x_{i-1}) where the x are the observed states.
Definition at line 78 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), computeD2Forward_(), computeDForward_(), computeForward_(), getD2LogLikelihoodForASite(), getDLogLikelihoodForASite(), operator=(), and RescaledHmmLikelihood().
|
private |
Definition at line 34 of file RescaledHmmLikelihood.h.
Referenced by computeBackward_(), computeD2Forward_(), computeDForward_(), computeForward_(), fireParameterChanged(), getHmmTransitionMatrix(), hmmTransitionMatrix(), operator=(), RescaledHmmLikelihood(), and setNamespace().