|
bpp-core
2.1.0
|
Basal interface for Hidden Markov Models likelihood computation. More...
#include <Bpp/Numeric/Hmm/HmmLikelihood.h>
Inheritance diagram for bpp::HmmLikelihood:
Collaboration diagram for bpp::HmmLikelihood:Public Member Functions | |
| virtual HmmLikelihood * | clone () const =0 |
| Create a copy of this object and send a pointer to it. | |
| 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 throw (Exception) |
| virtual double | getLogLikelihood () const =0 |
| virtual const std::vector < size_t > & | getBreakPoints () const =0 |
| virtual void | setBreakPoints (const std::vector< size_t > &breakPoints)=0 |
| virtual void | setParameters (const ParameterList ¶meters)=0 throw (ParameterNotFoundException, ConstraintException, Exception) |
| Set the point where the function must be computed. | |
| virtual double | getValue () const =0 throw (Exception) |
| Get the value of the function at the current point. | |
| virtual double | f (const ParameterList ¶meters) throw (Exception) |
| Get the value of the function according to a given set of parameters. | |
| virtual bool | hasParameter (const std::string &name) const =0 |
| Tell if there is a parameter with specified name. | |
| virtual const ParameterList & | getParameters () const =0 |
| Get all parameters available. | |
| virtual const Parameter & | getParameter (const std::string &name) const =0 throw (ParameterNotFoundException) |
| Get the parameter with specified name. | |
| virtual double | getParameterValue (const std::string &name) const =0 throw (ParameterNotFoundException) |
| Get the value for parameter of name 'name'. | |
| virtual void | setAllParametersValues (const ParameterList ¶meters)=0 throw (ParameterNotFoundException, ConstraintException) |
| Set the parameters values to be equals to those of parameters. | |
| virtual void | setParameterValue (const std::string &name, double value)=0 throw (ParameterNotFoundException, ConstraintException) |
| Set the value of parameter with name name to be equal to value. | |
| virtual void | setParametersValues (const ParameterList ¶meters)=0 throw (ParameterNotFoundException, ConstraintException) |
| Update the parameters from parameters. | |
| virtual bool | matchParametersValues (const ParameterList ¶meters)=0 throw (ConstraintException) |
| Update the parameters from parameters. | |
| virtual size_t | getNumberOfParameters () const =0 |
| Get the number of parameters. | |
| virtual void | setNamespace (const std::string &prefix)=0 |
| Set the namespace for the parameter names. | |
| 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. | |
Basal interface for Hidden Markov Models likelihood computation.
HmmLikelihood classes compute the probability of data according to parameters (likelihood), using the so-called forward recursion:
denotes the hidden states of the alphabet,
the probability of the data at position i conditioned on hidden state y (emission probabilities) and
is the probability of havving hidden state y at state i+1 knowing there is hidden state x at position i (transition probabilities). These essential elements are given respectively by the HmmEmissionProbabilities and HmmTransitionMatrix object associated to this class. Both objects have to share the same HmmStateAlphabet instance, which describes all allowed hidden states.The HmmLikelihood interface provides essentially two major methods:
Definition at line 74 of file HmmLikelihood.h.
| virtual HmmLikelihood* bpp::HmmLikelihood::clone | ( | ) | const [pure virtual] |
Create a copy of this object and send a pointer to it.
Implements bpp::Clonable.
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual double bpp::Function::f | ( | const ParameterList & | parameters | ) | throw (Exception) [inline, virtual, inherited] |
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::NewtonOneDimension::doStep(), bpp::ConjugateGradientMultiDimensions::doStep(), bpp::BfgsMultiDimensions::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::NewtonBacktrackOneDimension::doStep(), bpp::GoldenSectionSearch::doStep(), bpp::BrentOneDimension::doStep(), bpp::DownhillSimplexMethod::doStep(), bpp::FunctionWrapper::f(), bpp::PowellMultiDimensions::optimize(), bpp::BrentOneDimension::optimize(), bpp::DownhillSimplexMethod::optimize(), bpp::AbstractOptimizer::step(), and bpp::DownhillSimplexMethod::tryExtrapolation().
| virtual const std::vector<size_t>& bpp::HmmLikelihood::getBreakPoints | ( | ) | const [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual void bpp::HmmLikelihood::getHiddenStatesPosteriorProbabilities | ( | std::vector< std::vector< double > > & | probs, |
| bool | append | ||
| ) | const throw (Exception) [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual const HmmEmissionProbabilities& bpp::HmmLikelihood::getHmmEmissionProbabilities | ( | ) | const [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual HmmEmissionProbabilities& bpp::HmmLikelihood::getHmmEmissionProbabilities | ( | ) | [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual const HmmStateAlphabet& bpp::HmmLikelihood::getHmmStateAlphabet | ( | ) | const [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual HmmStateAlphabet& bpp::HmmLikelihood::getHmmStateAlphabet | ( | ) | [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual const HmmTransitionMatrix& bpp::HmmLikelihood::getHmmTransitionMatrix | ( | ) | const [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual HmmTransitionMatrix& bpp::HmmLikelihood::getHmmTransitionMatrix | ( | ) | [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual double bpp::HmmLikelihood::getLogLikelihood | ( | ) | const [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual std::string bpp::Parametrizable::getNamespace | ( | ) | const [pure virtual, inherited] |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getNamespace().
| virtual size_t bpp::Parametrizable::getNumberOfParameters | ( | ) | const [pure virtual, inherited] |
Get the number of parameters.
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, bpp::AbstractParametrizable, and bpp::DirectionFunction.
Referenced by bpp::FunctionWrapper::getNumberOfParameters(), and bpp::BppODiscreteDistributionFormat::write().
| virtual const Parameter& bpp::Parametrizable::getParameter | ( | const std::string & | name | ) | const throw (ParameterNotFoundException) [pure virtual, inherited] |
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::FunctionWrapper::getParameter().
| virtual std::string bpp::Parametrizable::getParameterNameWithoutNamespace | ( | const std::string & | name | ) | const [pure virtual, inherited] |
Resolves a parameter name according to the current namespace.
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::FunctionWrapper::getParameterNameWithoutNamespace(), bpp::BppODiscreteDistributionFormat::read(), and bpp::BppOParametrizableFormat::write().
| virtual const ParameterList& bpp::Parametrizable::getParameters | ( | ) | const [pure virtual, inherited] |
Get all parameters available.
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, bpp::DirectionFunction, and bpp::AbstractParametrizable.
Referenced by bpp::NewtonOneDimension::doStep(), bpp::FunctionWrapper::getParameters(), bpp::BppODiscreteDistributionFormat::read(), bpp::AbstractNumericalDerivative::setParameterValue(), bpp::AbstractOptimizer::step(), and bpp::BppOParametrizableFormat::write().
| virtual double bpp::Parametrizable::getParameterValue | ( | const std::string & | name | ) | const throw (ParameterNotFoundException) [pure virtual, inherited] |
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::FunctionWrapper::getParameterValue(), and bpp::BppODiscreteDistributionFormat::read().
| virtual double bpp::Function::getValue | ( | ) | const throw (Exception) [pure virtual, inherited] |
Get the value of the function at the current point.
| Exception | If no point is specified or if an error occured. |
Implemented in bpp::TestFunction, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::ReparametrizationFunctionWrapper, bpp::FivePointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::DirectionFunction, and bpp::TwoPointsNumericalDerivative.
Referenced by bpp::SimpleNewtonMultiDimensions::doStep(), bpp::SimpleMultiDimensions::doStep(), bpp::MetaOptimizer::doStep(), bpp::Function::f(), bpp::ReparametrizationFunctionWrapper::getValue(), bpp::FunctionWrapper::getValue(), and bpp::InfinityFunctionWrapper::getValue().
| virtual bool bpp::Parametrizable::hasParameter | ( | const std::string & | name | ) | const [pure virtual, inherited] |
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::FunctionWrapper::hasParameter().
| virtual bool bpp::Parametrizable::matchParametersValues | ( | const ParameterList & | parameters | ) | throw (ConstraintException) [pure virtual, inherited] |
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::InvariantMixedDiscreteDistribution::fireParameterChanged(), bpp::AbstractNumericalDerivative::matchParametersValues(), bpp::FunctionWrapper::matchParametersValues(), and bpp::InfinityFunctionWrapper::matchParametersValues().
| virtual void bpp::Parametrizable::setAllParametersValues | ( | const ParameterList & | parameters | ) | throw (ParameterNotFoundException, ConstraintException) [pure virtual, inherited] |
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::AbstractNumericalDerivative::setAllParametersValues(), bpp::FunctionWrapper::setAllParametersValues(), and bpp::InfinityFunctionWrapper::setAllParametersValues().
| virtual void bpp::HmmLikelihood::setBreakPoints | ( | const std::vector< size_t > & | breakPoints | ) | [pure virtual] |
Implemented in bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, and bpp::RescaledHmmLikelihood.
| virtual void bpp::Parametrizable::setNamespace | ( | const std::string & | prefix | ) | [pure virtual, inherited] |
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::FunctionWrapper, bpp::ParametrizableAdapter, bpp::AbstractParameterAliasable, bpp::MixtureOfDiscreteDistributions, bpp::AbstractParametrizable, and bpp::InvariantMixedDiscreteDistribution.
Referenced by bpp::InvariantMixedDiscreteDistribution::InvariantMixedDiscreteDistribution(), bpp::InvariantMixedDiscreteDistribution::setNamespace(), and bpp::FunctionWrapper::setNamespace().
| virtual void bpp::Function::setParameters | ( | const ParameterList & | parameters | ) | throw (ParameterNotFoundException, ConstraintException, Exception) [pure virtual, inherited] |
Set the point where the function must be computed.
| parameters | The parameter set to pass to the function. |
Implemented in bpp::TestFunction, bpp::InfinityFunctionWrapper, bpp::FunctionWrapper, bpp::AbstractNumericalDerivative, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::ReparametrizationFunctionWrapper, and bpp::DirectionFunction.
Referenced by bpp::DerivableSecondOrder::d2f(), bpp::DerivableFirstOrder::df(), bpp::NewtonOneDimension::doStep(), bpp::PowellMultiDimensions::doStep(), bpp::Function::f(), bpp::ReparametrizationFunctionWrapper::setParameters(), bpp::AbstractNumericalDerivative::setParameters(), bpp::FunctionWrapper::setParameters(), and bpp::InfinityFunctionWrapper::setParameters().
| virtual void bpp::Parametrizable::setParametersValues | ( | const ParameterList & | parameters | ) | throw (ParameterNotFoundException, ConstraintException) [pure virtual, inherited] |
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::AbstractNumericalDerivative::setParametersValues(), bpp::FunctionWrapper::setParametersValues(), and bpp::InfinityFunctionWrapper::setParametersValues().
| virtual void bpp::Parametrizable::setParameterValue | ( | const std::string & | name, |
| double | value | ||
| ) | throw (ParameterNotFoundException, ConstraintException) [pure virtual, inherited] |
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::AbstractNumericalDerivative::setParameterValue(), bpp::FunctionWrapper::setParameterValue(), and bpp::InfinityFunctionWrapper::setParameterValue().