bpp-core3
3.0.0
|
Partial implementation of HmmTransitionMatrix. More...
#include <Bpp/Numeric/Hmm/AbstractHmmTransitionMatrix.h>
Public Member Functions | |
AbstractHmmTransitionMatrix (const HmmStateAlphabet *alph, const std::string &prefix="") | |
AbstractHmmTransitionMatrix (const AbstractHmmTransitionMatrix &hptm) | |
AbstractHmmTransitionMatrix & | operator= (const AbstractHmmTransitionMatrix &hptm) |
const HmmStateAlphabet * | getHmmStateAlphabet () const |
void | setHmmStateAlphabet (const HmmStateAlphabet *stateAlphabet) |
Set the new hidden state alphabet. More... | |
size_t | getNumberOfStates () const |
std::vector< size_t > | sample (size_t size) const |
sampling of a sequence of states. Starting point is sampled from the equilibrium distribution. More... | |
virtual double | Pij (size_t i, size_t j) const =0 |
Get the transition probability between two states. More... | |
virtual const Matrix< double > & | getPij () const =0 |
Get all transition probabilities as a matrix. More... | |
virtual const std::vector< double > & | getEquilibriumFrequencies () const =0 |
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... | |
virtual Clonable * | clone () const =0 |
Create a copy of this object and send a pointer to it. More... | |
Protected Member Functions | |
virtual ParameterList & | getParameters_ ()=0 |
Get all parameters available. More... | |
Protected Attributes | |
RowMatrix< double > | pij_ |
RowMatrix< double > | tmpmat_ |
Vdouble | eqFreq_ |
bool | upToDate_ |
Private Attributes | |
const HmmStateAlphabet * | alph_ |
Partial implementation of HmmTransitionMatrix.
Definition at line 56 of file AbstractHmmTransitionMatrix.h.
AbstractHmmTransitionMatrix::AbstractHmmTransitionMatrix | ( | const HmmStateAlphabet * | alph, |
const std::string & | prefix = "" |
||
) |
Definition at line 50 of file AbstractHmmTransitionMatrix.cpp.
AbstractHmmTransitionMatrix::AbstractHmmTransitionMatrix | ( | const AbstractHmmTransitionMatrix & | hptm | ) |
Definition at line 58 of file AbstractHmmTransitionMatrix.cpp.
|
pure virtualinherited |
Create a copy of this object and send a pointer to it.
Implemented in bpp::TransformedParameter, bpp::MultipleDiscreteDistribution, bpp::DiscreteDistribution, bpp::ParameterListener, bpp::BppNumberI, bpp::HmmLikelihood, bpp::HmmEmissionProbabilities, bpp::Optimizer, bpp::OptimizationStopCondition, bpp::DerivableSecondOrder, bpp::DerivableFirstOrder, bpp::AbstractNumericalDerivative, bpp::Constraint, bpp::OutputStream, bpp::PlaceboTransformedParameter, bpp::IntervalTransformedParameter, bpp::RTransformedParameter, bpp::Table< T >, bpp::PrincipalComponentAnalysis, bpp::DualityDiagram, bpp::CorrespondenceAnalysis, bpp::ContingencyTableTest, bpp::Range< T >, bpp::UniformDiscreteDistribution, bpp::TruncatedExponentialDiscreteDistribution, bpp::Simplex, bpp::SimpleDiscreteDistribution, bpp::MixtureOfDiscreteDistributions, bpp::InvariantMixedDiscreteDistribution, bpp::GaussianDiscreteDistribution, bpp::GammaDiscreteDistribution, bpp::ExponentialDiscreteDistribution, bpp::DirichletDiscreteDistribution, bpp::ConstantDistribution, bpp::BetaDiscreteDistribution, bpp::ParametrizableCollection< N >, bpp::ParameterList, bpp::Parameter, bpp::ParameterEvent, bpp::BppUnsignedInteger, bpp::BppInteger, bpp::BppDouble, bpp::Number< T >, bpp::Number< double >, bpp::Number< int >, bpp::Number< unsigned int >, bpp::BppNotANumber, bpp::LinearMatrix< Scalar >, bpp::ColMatrix< Scalar >, bpp::RowMatrix< Scalar >, bpp::RowMatrix< double >, bpp::RowMatrix< Real >, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::LogsumHmmLikelihood, bpp::FullHmmTransitionMatrix, bpp::AutoCorrelationTransitionMatrix, bpp::TwoPointsNumericalDerivative, bpp::ThreePointsNumericalDerivative, bpp::SimpleNewtonMultiDimensions, bpp::SimpleMultiDimensions, bpp::ReparametrizationDerivableSecondOrderWrapper, bpp::ReparametrizationDerivableFirstOrderWrapper, bpp::ReparametrizationFunctionWrapper, bpp::PowellMultiDimensions, bpp::PowellMultiDimensions::PMDStopCondition, bpp::FunctionStopCondition, bpp::ParametersStopCondition, bpp::NegativeOperator, bpp::MathOperator, bpp::FunctionOperator< F >, bpp::ConstantOperator, bpp::ComputationTree, bpp::BinaryOperator, bpp::NewtonOneDimension, bpp::NewtonBacktrackOneDimension, bpp::NewtonBacktrackOneDimension::NBODStopCondition, bpp::MetaOptimizer, bpp::MetaOptimizerInfos, bpp::GoldenSectionSearch, bpp::GoldenSectionSearch::GSSStopCondition, bpp::TestFunction, bpp::InfinityDerivableSecondOrderWrapper, bpp::InfinityDerivableFirstOrderWrapper, bpp::InfinityFunctionWrapper, bpp::FivePointsNumericalDerivative, bpp::DownhillSimplexMethod, bpp::DownhillSimplexMethod::DSMStopCondition, bpp::DirectionFunction, bpp::ConjugateGradientMultiDimensions, bpp::BrentOneDimension, bpp::BrentOneDimension::BODStopCondition, bpp::BfgsMultiDimensions, bpp::DataTable, bpp::IntervalConstraint, bpp::AutoParameter, bpp::AliasParameterListener, bpp::StdErr, bpp::StdOut, bpp::StlOutputStreamWrapper, bpp::StlOutputStream, bpp::NullOutputStream, bpp::RGBColor, bpp::Point2D< T >, bpp::Font, bpp::GlobalGraph, bpp::AssociationTreeGraphImplObserver< N, E, TreeGraphImpl >, bpp::AssociationGraphImplObserver< N, E, GraphImpl >, bpp::AssociationGraphImplObserver< N, E, DAGraphImpl >, bpp::AssociationGraphImplObserver< N, E, TreeGraphImpl >, bpp::AssociationDAGraphImplObserver< N, E, DAGraphImpl >, bpp::BppVector< T >, bpp::BppString, and bpp::BppBoolean.
Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::LogsumHmmLikelihood::LogsumHmmLikelihood(), and bpp::LogsumHmmLikelihood::operator=().
|
pure virtualinherited |
Implemented in bpp::FullHmmTransitionMatrix, and bpp::AutoCorrelationTransitionMatrix.
Referenced by bpp::LogsumHmmLikelihood::computeForward_().
|
inlinevirtual |
Implements bpp::HmmTransitionMatrix.
Definition at line 79 of file AbstractHmmTransitionMatrix.h.
References alph_.
Referenced by sample().
|
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().
|
inlinevirtual |
Implements bpp::HmmTransitionMatrix.
Definition at line 95 of file AbstractHmmTransitionMatrix.h.
References alph_, and bpp::HmmStateAlphabet::getNumberOfStates().
Referenced by bpp::AutoCorrelationTransitionMatrix::AutoCorrelationTransitionMatrix(), bpp::AutoCorrelationTransitionMatrix::fireParameterChanged(), bpp::FullHmmTransitionMatrix::fireParameterChanged(), bpp::FullHmmTransitionMatrix::FullHmmTransitionMatrix(), bpp::FullHmmTransitionMatrix::getEquilibriumFrequencies(), bpp::AutoCorrelationTransitionMatrix::getPij(), and bpp::AutoCorrelationTransitionMatrix::Pij().
|
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().
|
pure virtualinherited |
Get all transition probabilities as a matrix.
Implemented in bpp::FullHmmTransitionMatrix, and bpp::AutoCorrelationTransitionMatrix.
Referenced by bpp::LogsumHmmLikelihood::computeD2Forward_(), bpp::LogsumHmmLikelihood::computeDForward_(), and sample().
|
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().
AbstractHmmTransitionMatrix & AbstractHmmTransitionMatrix::operator= | ( | const AbstractHmmTransitionMatrix & | hptm | ) |
Definition at line 66 of file AbstractHmmTransitionMatrix.cpp.
References alph_, eqFreq_, pij_, tmpmat_, and upToDate_.
Referenced by bpp::AutoCorrelationTransitionMatrix::operator=(), and bpp::FullHmmTransitionMatrix::operator=().
|
pure virtualinherited |
Get the transition probability between two states.
i | initial state. |
j | final state. |
Implemented in bpp::FullHmmTransitionMatrix, and bpp::AutoCorrelationTransitionMatrix.
Referenced by bpp::LogsumHmmLikelihood::computeBackward_(), and bpp::LogsumHmmLikelihood::computeForward_().
vector< size_t > AbstractHmmTransitionMatrix::sample | ( | size_t | size | ) | const |
sampling of a sequence of states. Starting point is sampled from the equilibrium distribution.
size | the length of the sequence |
Definition at line 85 of file AbstractHmmTransitionMatrix.cpp.
References eqFreq_, getHmmStateAlphabet(), bpp::HmmStateAlphabet::getNumberOfStates(), bpp::HmmTransitionMatrix::getPij(), bpp::RowMatrix< Scalar >::getRow(), bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry(), and pij_.
|
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().
|
virtual |
Set the new hidden state alphabet.
stateAlphabet | The new state alphabet |
UnvalidStateAlphabetException | if the new alphabet is uncorrect (for instance is NULL pointer). |
Implements bpp::HmmTransitionMatrix.
Definition at line 77 of file AbstractHmmTransitionMatrix.cpp.
References alph_.
|
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 |
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().
|
private |
Definition at line 60 of file AbstractHmmTransitionMatrix.h.
Referenced by getHmmStateAlphabet(), getNumberOfStates(), operator=(), and setHmmStateAlphabet().
|
mutableprotected |
Definition at line 65 of file AbstractHmmTransitionMatrix.h.
Referenced by bpp::AutoCorrelationTransitionMatrix::AutoCorrelationTransitionMatrix(), bpp::AutoCorrelationTransitionMatrix::getEquilibriumFrequencies(), bpp::FullHmmTransitionMatrix::getEquilibriumFrequencies(), operator=(), and sample().
|
mutableprotected |
Definition at line 63 of file AbstractHmmTransitionMatrix.h.
Referenced by bpp::FullHmmTransitionMatrix::getEquilibriumFrequencies(), bpp::AutoCorrelationTransitionMatrix::getPij(), bpp::FullHmmTransitionMatrix::getPij(), operator=(), and sample().
|
protected |
Definition at line 63 of file AbstractHmmTransitionMatrix.h.
Referenced by bpp::FullHmmTransitionMatrix::getEquilibriumFrequencies(), and operator=().
|
mutableprotected |
Definition at line 67 of file AbstractHmmTransitionMatrix.h.
Referenced by bpp::AutoCorrelationTransitionMatrix::fireParameterChanged(), bpp::FullHmmTransitionMatrix::fireParameterChanged(), bpp::FullHmmTransitionMatrix::getEquilibriumFrequencies(), bpp::AutoCorrelationTransitionMatrix::getPij(), bpp::FullHmmTransitionMatrix::getPij(), and operator=().