bpp-core3
3.0.0
|
Interface for multiple discrete distribution objects. More...
#include <Bpp/Numeric/Prob/MultipleDiscreteDistribution.h>
Public Member Functions | |
MultipleDiscreteDistribution () | |
virtual | ~MultipleDiscreteDistribution () |
MultipleDiscreteDistribution * | clone () const =0 |
Create a copy of this object and send a pointer to it. More... | |
virtual size_t | getNumberOfCategories () const =0 |
virtual Vdouble | getValueCategory (Vdouble &Vvalue) const =0 |
virtual double | getProbability (Vdouble &category) const =0 |
virtual Vdouble | rand () const =0 |
Draw a random vector from this distribution. More... | |
virtual Vdouble | randC () const =0 |
Draw a random vector from the continuous version of this distribution, if it exists. More... | |
virtual size_t | getNumberOfIndependentParameters () const =0 |
Get the number of independent parameters. More... | |
virtual void | aliasParameters (const std::string &p1, const std::string &p2)=0 |
Set two parameters as 'aliased'. More... | |
virtual void | aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)=0 |
alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden. More... | |
virtual void | unaliasParameters (const std::string &p1, const std::string &p2)=0 |
Detach two parameters previously set as 'aliased'. More... | |
virtual const ParameterList & | getIndependentParameters () const =0 |
Get the minimal list of parameters to set the model. More... | |
virtual std::vector< std::string > | getAlias (const std::string &name) const =0 |
virtual std::map< std::string, std::string > | getAliases () 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 & | 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 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 ParameterList & | getParameters_ ()=0 |
Get all parameters available. More... | |
Interface for multiple discrete distribution objects.
A multiple discrete distribution usually contains a vector of finite set of categories and a probability associated to each. The size of the vector is the dimension of the distribution.
Each category (or class) is defined by two bounds, and sometimes by a mean or a median value.
A multiple discrete distribution may contain one or several parameters. The probabilities associated to each class usually depends on the parameter values. In some cases, the number and/or bounds of the classes may also depend on the parameters values, depending on the kind of discretization used.
Definition at line 33 of file MultipleDiscreteDistribution.h.
|
inline |
Definition at line 37 of file MultipleDiscreteDistribution.h.
|
inlinevirtual |
Definition at line 39 of file MultipleDiscreteDistribution.h.
References clone(), getNumberOfCategories(), getProbability(), getValueCategory(), rand(), and randC().
|
pure virtualinherited |
Set two parameters as 'aliased'.
The values of the two parameters will be synchronized, so that setting the value of one parameter will automatically set the value of the other one accordingly.
p1 | Original parameter. |
p2 | Aliased parameter. |
ParameterNotFoundException | if p1 or p2 do not correspond to existing parameters. |
Exception | when trying to perform non-valid association. |
Implemented in bpp::AbstractParameterAliasable.
Referenced by bpp::ParameterAliasable::~ParameterAliasable().
|
pure virtualinherited |
alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden.
unparsedParams | the map of the links : <A,B> matches for A->B aliasing. |
verbose | verbosity |
Implemented in bpp::AbstractParameterAliasable.
|
pure virtual |
Create a copy of this object and send a pointer to it.
Implements bpp::Clonable.
Implemented in bpp::DirichletDiscreteDistribution.
Referenced by ~MultipleDiscreteDistribution().
|
pure virtualinherited |
name | The name of the parameter to look for. |
Implemented in bpp::AbstractParameterAliasable.
Referenced by bpp::ParametrizableCollection< N >::addObject(), bpp::BppOParametrizableFormat::write(), and bpp::ParameterAliasable::~ParameterAliasable().
|
pure virtualinherited |
Implemented in bpp::AbstractParameterAliasable.
Referenced by bpp::ParameterAliasable::~ParameterAliasable().
|
pure virtualinherited |
Get the minimal list of parameters to set the model.
If no parameters are aliased, this is the same a getParameters().
Implemented in bpp::AbstractParameterAliasable.
Referenced by bpp::BppODiscreteDistributionFormat::initialize_(), bpp::BppOParametrizableFormat::write(), bpp::BppODiscreteDistributionFormat::writeDiscreteDistribution(), and bpp::ParameterAliasable::~ParameterAliasable().
|
pure virtualinherited |
Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.
Referenced by bpp::Parametrizable::~Parametrizable().
|
pure virtual |
Implemented in bpp::DirichletDiscreteDistribution.
Referenced by ~MultipleDiscreteDistribution().
|
pure virtualinherited |
Get the number of independent parameters.
Implemented in bpp::AbstractParameterAliasable.
Referenced by bpp::ParameterAliasable::~ParameterAliasable().
|
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().
|
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().
|
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().
|
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().
|
pure virtual |
category | The vector of values associated to the class. |
Implemented in bpp::DirichletDiscreteDistribution.
Referenced by ~MultipleDiscreteDistribution().
|
pure virtual |
Vvalue | The vector of values to check. |
Implemented in bpp::DirichletDiscreteDistribution.
Referenced by ~MultipleDiscreteDistribution().
|
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().
|
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().
|
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().
|
pure virtual |
Draw a random vector from this distribution.
This vector will be one of the class values, drawn according to the class probabilities.
Implemented in bpp::DirichletDiscreteDistribution.
Referenced by ~MultipleDiscreteDistribution().
|
pure virtual |
Draw a random vector from the continuous version of this distribution, if it exists.
Uses the continuous version of this distribution to draw a random vector.
Exception | If there is no continuous version of this distribution. |
Implemented in bpp::DirichletDiscreteDistribution.
Referenced by ~MultipleDiscreteDistribution().
|
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().
|
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().
|
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().
|
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::FunctionWrapper, bpp::ParametrizableAdapter, bpp::LogsumHmmLikelihood, bpp::RescaledHmmLikelihood, bpp::LowMemoryRescaledHmmLikelihood, bpp::AbstractParameterAliasable, bpp::MixtureOfDiscreteDistributions, bpp::AbstractParametrizable, and bpp::InvariantMixedDiscreteDistribution.
Referenced by bpp::Parametrizable::~Parametrizable().
|
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().
|
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().
|
pure virtualinherited |
Detach two parameters previously set as 'aliased'.
The values of the two parameters will now be independent.
p1 | Original parameter. |
p2 | Aliased parameter. |
ParameterNotFoundException | if p1 or p2 do not correspond to existing parameters. |
Exception | when trying to perform non-valid dissociation. |
Implemented in bpp::AbstractParameterAliasable.
Referenced by bpp::ParameterAliasable::~ParameterAliasable().