bpp-core3
3.0.0
|
#include <Bpp/Numeric/Hmm/HmmLikelihood.h>
Public Member Functions | |
AbstractHmmLikelihood () | |
AbstractHmmLikelihood (const AbstractHmmLikelihood &adhlik) | |
AbstractHmmLikelihood & | operator= (const AbstractHmmLikelihood &adhlik) |
void | enableFirstOrderDerivatives (bool yn) |
Tell if derivatives must be computed. 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) |
Tell if derivatives must be computed. 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 | getD2LogLikelihood () const |
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... | |
virtual HmmLikelihood * | clone () const =0 |
Create a copy of this object and send a pointer to it. More... | |
virtual const HmmStateAlphabet & | getHmmStateAlphabet () const =0 |
virtual HmmStateAlphabet & | getHmmStateAlphabet ()=0 |
virtual const HmmTransitionMatrix & | getHmmTransitionMatrix () const =0 |
virtual HmmTransitionMatrix & | getHmmTransitionMatrix ()=0 |
virtual const HmmEmissionProbabilities & | getHmmEmissionProbabilities () const =0 |
virtual HmmEmissionProbabilities & | getHmmEmissionProbabilities ()=0 |
virtual void | getHiddenStatesPosteriorProbabilities (std::vector< std::vector< double > > &probs, bool append) const =0 |
virtual Vdouble | getHiddenStatesPosteriorProbabilitiesForASite (size_t site) const =0 |
virtual double | getLogLikelihood () const =0 |
virtual double | getLikelihoodForASite (size_t site) const =0 |
Get the likelihood for a site, and its derivatives. More... | |
virtual double | getDLogLikelihoodForASite (size_t site) const =0 |
virtual double | getD2LogLikelihoodForASite (size_t site) const =0 |
virtual Vdouble | getLikelihoodForEachSite () const =0 |
Get the likelihood for each site. More... | |
virtual const std::vector< size_t > & | getBreakPoints () const =0 |
virtual void | setBreakPoints (const std::vector< size_t > &breakPoints)=0 |
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 void | setParameters (const ParameterList ¶meters)=0 |
Set the point where the function must be computed. More... | |
virtual double | getValue () const =0 |
Get the value of the function at the current point. 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 & | getParameter (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 size_t | getNumberOfParameters () const =0 |
Get the number of parameters. More... | |
virtual void | setNamespace (const std::string &prefix)=0 |
Set the namespace for the parameter names. 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... | |
Protected Member Functions | |
virtual void | computeDLikelihood_ () const =0 |
virtual void | computeD2Likelihood_ () const =0 |
virtual ParameterList & | getParameters_ ()=0 |
Get all parameters available. More... | |
Protected Attributes | |
double | dLogLik_ |
std::string | dVariable_ |
double | d2LogLik_ |
std::string | d2Variable_ |
Definition at line 138 of file HmmLikelihood.h.
AbstractHmmLikelihood::AbstractHmmLikelihood | ( | ) |
Definition at line 47 of file HmmLikelihood.cpp.
AbstractHmmLikelihood::AbstractHmmLikelihood | ( | const AbstractHmmLikelihood & | adhlik | ) |
Definition at line 53 of file HmmLikelihood.cpp.
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implements bpp::DerivableSecondOrder.
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
protectedpure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
Referenced by getSecondOrderDerivative().
|
protectedpure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
Referenced by getFirstOrderDerivative().
|
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 228 of file Functions.h.
References bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::Function::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 255 of file Functions.h.
References bpp::DerivableSecondOrder::getSecondOrderDerivative(), and bpp::Function::setParameters().
|
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 173 of file Functions.h.
References bpp::DerivableFirstOrder::getFirstOrderDerivative(), and bpp::Function::setParameters().
|
inlinevirtual |
Tell if derivatives must be computed.
Implements bpp::DerivableFirstOrder.
Definition at line 162 of file HmmLikelihood.h.
|
inlinevirtual |
Tell if derivatives must be computed.
yn | yes/no |
Implements bpp::DerivableFirstOrder.
Definition at line 160 of file HmmLikelihood.h.
|
inlinevirtual |
Tell if derivatives must be computed.
Implements bpp::DerivableSecondOrder.
Definition at line 183 of file HmmLikelihood.h.
|
inlinevirtual |
Tell if derivatives must be computed.
yn | yes/no |
Implements bpp::DerivableSecondOrder.
Definition at line 181 of file HmmLikelihood.h.
|
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 117 of file Functions.h.
References bpp::Function::getValue(), and bpp::Function::setParameters().
Referenced by bpp::BrentOneDimension::doInit(), bpp::DownhillSimplexMethod::doInit(), bpp::GoldenSectionSearch::doInit(), bpp::NewtonBacktrackOneDimension::doInit(), bpp::NewtonOneDimension::doInit(), bpp::PowellMultiDimensions::doInit(), bpp::BfgsMultiDimensions::doStep(), bpp::BrentOneDimension::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::DownhillSimplexMethod::doStep(), bpp::NewtonBacktrackOneDimension::doStep(), bpp::NewtonOneDimension::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::FunctionWrapper::f(), bpp::BrentOneDimension::optimize(), bpp::DownhillSimplexMethod::optimize(), bpp::PowellMultiDimensions::optimize(), bpp::AbstractOptimizer::step(), bpp::DownhillSimplexMethod::tryExtrapolation(), and bpp::NumTools::uniRoot().
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
inlinevirtual |
Implements bpp::HmmLikelihood.
Definition at line 187 of file HmmLikelihood.h.
References d2LogLik_.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
inlinevirtual |
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
virtual |
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::DerivableFirstOrder.
Definition at line 70 of file HmmLikelihood.cpp.
References bpp::HmmEmissionProbabilities::computeDEmissionProbabilities(), bpp::HmmLikelihood::computeDLikelihood_(), dLogLik_, dVariable_, and bpp::HmmLikelihood::getHmmEmissionProbabilities().
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_().
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
Referenced by getFirstOrderDerivative(), and getSecondOrderDerivative().
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Get the likelihood for a site, and its derivatives.
site | The site index to analyse. |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Get the likelihood for each site.
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getNamespace().
|
pure virtualinherited |
Get the number of parameters.
Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, bpp::DirectionFunction, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getNumberOfParameters(), and bpp::BppODiscreteDistributionFormat::writeDiscreteDistribution().
|
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::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getParameter().
|
pure virtualinherited |
Resolves a parameter name according to the current namespace.
Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getParameterNameWithoutNamespace(), and bpp::BppOParametrizableFormat::write().
|
pure virtualinherited |
Get all parameters available.
Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, bpp::DirectionFunction, and bpp::AbstractParametrizable.
Referenced by bpp::NewtonOneDimension::doStep(), bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::FunctionWrapper::getParameters(), bpp::LogsumHmmLikelihood::LogsumHmmLikelihood(), bpp::AbstractNumericalDerivative::setParameterValue(), bpp::AbstractOptimizer::step(), and bpp::BppOParametrizableFormat::write().
|
protectedpure virtualinherited |
Get all parameters available.
Implemented in bpp::FunctionWrapper, bpp::DirectionFunction, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getParameters_().
|
pure virtualinherited |
Get the value for parameter of name 'name'.
name | The name of the parameter. |
Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getParameterValue().
|
virtual |
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::DerivableSecondOrder.
Definition at line 82 of file HmmLikelihood.cpp.
References bpp::HmmEmissionProbabilities::computeD2EmissionProbabilities(), bpp::HmmLikelihood::computeD2Likelihood_(), d2LogLik_, d2Variable_, and bpp::HmmLikelihood::getHmmEmissionProbabilities().
|
inlinevirtual |
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::DerivableSecondOrder.
Definition at line 192 of file HmmLikelihood.h.
|
pure virtualinherited |
Get the value of the function at the current point.
Exception | If no point is specified or if an error occured. |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::TwoPointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::ReparametrizationFunctionWrapper, bpp::TestFunction, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::FivePointsNumericalDerivative, and bpp::DirectionFunction.
Referenced by bpp::MetaOptimizer::doInit(), bpp::MetaOptimizer::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::SimpleNewtonMultiDimensions::doStep(), bpp::Function::f(), bpp::FunctionWrapper::getValue(), bpp::InfinityFunctionWrapper::getValue(), bpp::ReparametrizationFunctionWrapper::getValue(), and bpp::AbstractOptimizer::init().
|
pure virtualinherited |
Tell if there is a parameter with specified name.
name | The name of the parameter to look for. |
Implemented in bpp::ParametrizableAdapter, bpp::FunctionWrapper, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::hasParameter().
|
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::ParametrizableAdapter, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, and bpp::AbstractParametrizable.
Referenced by bpp::InvariantMixedDiscreteDistribution::fireParameterChanged(), bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::BppODiscreteDistributionFormat::initialize_(), bpp::AbstractNumericalDerivative::matchParametersValues(), bpp::FunctionWrapper::matchParametersValues(), and bpp::InfinityFunctionWrapper::matchParametersValues().
AbstractHmmLikelihood & AbstractHmmLikelihood::operator= | ( | const AbstractHmmLikelihood & | adhlik | ) |
Definition at line 60 of file HmmLikelihood.cpp.
References d2LogLik_, d2Variable_, dLogLik_, and dVariable_.
Referenced by bpp::LogsumHmmLikelihood::operator=(), bpp::LowMemoryRescaledHmmLikelihood::operator=(), and bpp::RescaledHmmLikelihood::operator=().
|
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::ParametrizableAdapter, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, and bpp::AbstractParametrizable.
Referenced by bpp::AbstractNumericalDerivative::setAllParametersValues(), bpp::FunctionWrapper::setAllParametersValues(), and bpp::InfinityFunctionWrapper::setAllParametersValues().
|
pure virtualinherited |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
|
pure virtualinherited |
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. |
Implemented in bpp::MixtureOfDiscreteDistributions, bpp::InvariantMixedDiscreteDistribution, bpp::ParametrizableAdapter, bpp::FunctionWrapper, bpp::AbstractParametrizable, bpp::AbstractParameterAliasable, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, and bpp::LogsumHmmLikelihood.
Referenced by bpp::InvariantMixedDiscreteDistribution::InvariantMixedDiscreteDistribution(), bpp::LogsumHmmLikelihood::setNamespace(), bpp::FunctionWrapper::setNamespace(), and bpp::InvariantMixedDiscreteDistribution::setNamespace().
|
pure virtualinherited |
Set the point where the function must be computed.
parameters | The parameter set to pass to the function. |
Implemented in bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::ReparametrizationFunctionWrapper, bpp::TestFunction, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::DirectionFunction, and bpp::AbstractNumericalDerivative.
Referenced by bpp::DerivableSecondOrder::d2f(), bpp::DerivableFirstOrder::df(), bpp::MetaOptimizer::doInit(), bpp::BfgsMultiDimensions::doInit(), bpp::ConjugateGradientMultiDimensions::doInit(), bpp::SimpleMultiDimensions::doInit(), bpp::SimpleNewtonMultiDimensions::doInit(), bpp::NewtonOneDimension::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::Function::f(), bpp::AbstractNumericalDerivative::setParameters(), bpp::FunctionWrapper::setParameters(), bpp::InfinityFunctionWrapper::setParameters(), and bpp::ReparametrizationFunctionWrapper::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::ParametrizableAdapter, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, and bpp::AbstractParametrizable.
Referenced by bpp::LogsumHmmLikelihood::fireParameterChanged(), bpp::AbstractNumericalDerivative::setParametersValues(), bpp::FunctionWrapper::setParametersValues(), and bpp::InfinityFunctionWrapper::setParametersValues().
|
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::ParametrizableAdapter, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, and bpp::AbstractParametrizable.
Referenced by bpp::AbstractNumericalDerivative::setParameterValue(), bpp::FunctionWrapper::setParameterValue(), and bpp::InfinityFunctionWrapper::setParameterValue().
|
mutableprotected |
Definition at line 145 of file HmmLikelihood.h.
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_(), bpp::RescaledHmmLikelihood::computeD2Forward_(), getD2LogLikelihood(), getSecondOrderDerivative(), and operator=().
|
mutableprotected |
Definition at line 146 of file HmmLikelihood.h.
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_(), bpp::LogsumHmmLikelihood::fireParameterChanged(), getSecondOrderDerivative(), and operator=().
|
mutableprotected |
Definition at line 142 of file HmmLikelihood.h.
Referenced by bpp::RescaledHmmLikelihood::computeD2Forward_(), bpp::LogsumHmmLikelihood::computeDForward_(), bpp::RescaledHmmLikelihood::computeDForward_(), getDLogLikelihood(), getFirstOrderDerivative(), and operator=().
|
mutableprotected |
Definition at line 143 of file HmmLikelihood.h.
Referenced by bpp::LogsumHmmLikelihood::fireParameterChanged(), getFirstOrderDerivative(), and operator=().