bpp-core  2.1.0
bpp::GammaDiscreteDistribution Class Reference

Discretized Gamma distribution. More...

#include <Bpp/Numeric/Prob/GammaDiscreteDistribution.h>

+ Inheritance diagram for bpp::GammaDiscreteDistribution:
+ Collaboration diagram for bpp::GammaDiscreteDistribution:

List of all members.

Public Member Functions

std::string getName () const
 Get the name of the distribution.
 GammaDiscreteDistribution (size_t n, double alpha=1., double beta=1., double minimumAlpha=0.05, double minimumBeta=0.05)
 Build a new discretized gamma distribution.
 GammaDiscreteDistribution (const GammaDiscreteDistribution &)
GammaDiscreteDistributionoperator= (const GammaDiscreteDistribution &)
virtual ~GammaDiscreteDistribution ()
GammaDiscreteDistributionclone () const
 Create a copy of this object and send a pointer to it.
void fireParameterChanged (const ParameterList &parameters)
 Notify the class when one or several parameters have changed.
double randC () const throw (Exception)
 Draw a random number from the continuous version of this distribution, if it exists.
double qProb (double x) const
 Return the quantile of the continuous version of the distribution, ie y such that $ Prob(X<y)=x $.
double pProb (double x) const
 Return the cumulative quantile of the continuous version of the distribution, ie $ Prob(X<x) $.
double Expectation (double a) const
 Return a primitive function used for the expectation of the continuous version of the distribution, ie $ E(X|...<=X<a) = \int_{...}^a t.dProb(t) dt $.
virtual void restrictToConstraint (const Constraint &c)
 Restricts the distribution to the domain where the constraint is respected, in addition of other predefined constraints.
virtual size_t getNumberOfIndependentParameters () const =0
 Get the number of independent parameters.
size_t getNumberOfIndependentParameters () const
 Get the number of independent parameters.
virtual void aliasParameters (const std::string &p1, const std::string &p2)=0 throw (ParameterNotFoundException, Exception)
 Set two parameters as 'aliased'.
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.
void aliasParameters (const std::string &p1, const std::string &p2) throw (ParameterNotFoundException, Exception)
 Set two parameters as 'aliased'.
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden.
virtual void unaliasParameters (const std::string &p1, const std::string &p2)=0 throw (ParameterNotFoundException, Exception)
 Detach two parameters previously set as 'aliased'.
void unaliasParameters (const std::string &p1, const std::string &p2) throw (ParameterNotFoundException, Exception)
 Detach two parameters previously set as 'aliased'.
virtual const ParameterListgetIndependentParameters () const =0
 Get the minimal list of parameters to set the model.
const ParameterListgetIndependentParameters () const
 Get the minimal list of parameters to set the model.
virtual std::vector< std::string > getAlias (const std::string &name) const =0
std::vector< std::string > getAlias (const std::string &name) const
virtual bool hasParameter (const std::string &name) const =0
 Tell if there is a parameter with specified name.
bool hasParameter (const std::string &name) const
 Tell if there is a parameter with specified name.
virtual const ParameterListgetParameters () const =0
 Get all parameters available.
const ParameterListgetParameters () const
 Get all parameters available.
virtual const ParametergetParameter (const std::string &name) const =0 throw (ParameterNotFoundException)
 Get the parameter with specified name.
const ParametergetParameter (const std::string &name) const 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'.
double getParameterValue (const std::string &name) const throw (ParameterNotFoundException)
 Get the value for parameter of name 'name'.
virtual void setAllParametersValues (const ParameterList &parameters)=0 throw (ParameterNotFoundException, ConstraintException)
 Set the parameters values to be equals to those of parameters.
void setAllParametersValues (const ParameterList &parameters) 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.
void setParameterValue (const std::string &name, double value) throw (ParameterNotFoundException, ConstraintException)
 Set the value of parameter with name name to be equal to value.
virtual void setParametersValues (const ParameterList &parameters)=0 throw (ParameterNotFoundException, ConstraintException)
 Update the parameters from parameters.
void setParametersValues (const ParameterList &parameters) throw (ParameterNotFoundException, ConstraintException)
 Update the parameters from parameters.
virtual bool matchParametersValues (const ParameterList &parameters)=0 throw (ConstraintException)
 Update the parameters from parameters.
bool matchParametersValues (const ParameterList &parameters) throw (ConstraintException)
 Update the parameters from parameters.
virtual size_t getNumberOfParameters () const =0
 Get the number of parameters.
size_t getNumberOfParameters () const
 Get the number of parameters.
virtual void setNamespace (const std::string &prefix)=0
 Set the namespace for the parameter names.
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names.
virtual std::string getNamespace () const =0
std::string getNamespace () const
virtual std::string getParameterNameWithoutNamespace (const std::string &name) const =0
 Resolves a parameter name according to the current namespace.
std::string getParameterNameWithoutNamespace (const std::string &name) const
 Resolves a parameter name according to the current namespace.
ParameterList getAliasedParameters (const ParameterList &pl) const
 Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list.
std::string getFrom (const std::string &name) const
The DiscreteDistribution interface.
size_t getNumberOfCategories () const
void setNumberOfCategories (size_t nbClasses)
 sets the number of categories and discretizes if there is a change in this number.
double getCategory (size_t categoryIndex) const
double getProbability (size_t categoryIndex) const
double getProbability (double category) const
Vdouble getCategories () const
Vdouble getProbabilities () const
double getValueCategory (double value) const
void set (double category, double probability)
 Set the probability associated to a class.
void add (double category, double probability)
 Modify the probability associated to a class.
double getInfCumulativeProbability (double category) const
double getIInfCumulativeProbability (double category) const
double getSupCumulativeProbability (double category) const
double getSSupCumulativeProbability (double category) const
double rand () const
 Draw a random number from this distribution.
double getBound (size_t i) const throw (IndexOutOfBoundsException)
double getLowerBound () const
 methods about the range of the definition
double getUpperBound () const
bool strictLowerBound () const
bool strictUpperBound () const
Vdouble getBounds () const
void print (OutputStream &out) const
 Print the distribution (categories and corresponding probabilities) to a stream.
double precision () const
void setMedian (bool median)
 Sets the median value to true to say that the value in a class is proportional to the median value of the class, the proportionality factor being such that the sum of the values equals the expectation of the distribution. If it is set to false, the value is the mean value in the class.
virtual void discretize ()
 Discretizes the distribution in equiprobable classes.

Protected Member Functions

void addParameter_ (Parameter *parameter)
void addParameters_ (const ParameterList &parameters)
void deleteParameter_ (size_t index) throw (IndexOutOfBoundsException)
void deleteParameter_ (std::string &name) throw (IndexOutOfBoundsException)
void deleteParameters_ (const std::vector< std::string > &names)
void resetParameters_ ()
ParametergetParameter_ (const std::string &name) throw (ParameterNotFoundException)
ParametergetParameter_ (size_t index) throw (IndexOutOfBoundsException)
const ParametergetParameter_ (size_t index) const throw (IndexOutOfBoundsException)
ParametergetParameterWithNamespace_ (const std::string &name) throw (ParameterNotFoundException)
const ParametergetParameterWithNamespace_ (const std::string &name) const throw (ParameterNotFoundException)
ParameterListgetParameters_ ()

Protected Attributes

size_t numberOfCategories_
std::map< double, double, Orderdistribution_
std::vector< double > bounds_
IntervalConstraint intMinMax_
 the interval where the distribution is defined/restricted.
bool median_

Private Attributes

double alpha_
double beta_
double ga1_

Detailed Description

Discretized Gamma distribution.

Author:
Julien Dutheil, Laurent Gu├ęguen, with original code from Tal Pupko and Ziheng Yang.

Definition at line 56 of file GammaDiscreteDistribution.h.


Constructor & Destructor Documentation

GammaDiscreteDistribution::GammaDiscreteDistribution ( size_t  n,
double  alpha = 1.,
double  beta = 1.,
double  minimumAlpha = 0.05,
double  minimumBeta = 0.05 
)

Build a new discretized gamma distribution.

Parameters:
nthe number of categories to use.
alphaThe alpha parameter (shape)
betaThe beta parameter (rate)
minimumAlphaThe minimum allowed value for parameter alpha.
minimumBetaThe minimum allowed value for parameter beta.

The Parameters are: alpha and beta $ \in [minimumBound;\infty[ $. Small values of alpha and/or beta can lead to discretization issues.

If $ alpha > 1 $, the minimum value of the distribution is set to 1e-12, otherwise it is 0.

Constructor:

Definition at line 54 of file GammaDiscreteDistribution.cpp.

References bpp::AbstractParameterAliasable::addParameter_(), alpha_, bpp::AbstractDiscreteDistribution::discretize(), ga1_, bpp::AbstractDiscreteDistribution::intMinMax_, bpp::RandomTools::lnGamma(), and bpp::IntervalConstraint::setLowerBound().

Referenced by clone().


Member Function Documentation

void AbstractDiscreteDistribution::add ( double  category,
double  probability 
) [virtual, inherited]

Modify the probability associated to a class.

If the category does not exist, a new category is created with the corresponding probability. if the category exists, add 'probability' to the existing probability. The sum of all probabilities is not checked.

Parameters:
categoryThe class value.
probabilityThe class probability.

Implements bpp::DiscreteDistribution.

Definition at line 181 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

virtual void bpp::ParameterAliasable::aliasParameters ( const std::string &  p1,
const std::string &  p2 
) throw (ParameterNotFoundException, Exception) [pure virtual, inherited]

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.

Parameters:
p1Original parameter.
p2Aliased parameter.
Exceptions:
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid association.

Implemented in bpp::AbstractParameterAliasable.

virtual void bpp::ParameterAliasable::aliasParameters ( std::map< std::string, std::string > &  unparsedParams,
bool  verbose 
) [pure virtual, inherited]

alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden.

Parameters:
unparsedParamsthe map of the links : <A,B> matches for A->B aliasing.
verboseverbosity

Implemented in bpp::AbstractParameterAliasable.

void AbstractParameterAliasable::aliasParameters ( const std::string &  p1,
const std::string &  p2 
) throw (ParameterNotFoundException, Exception) [virtual, inherited]

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.

Parameters:
p1Original parameter.
p2Aliased parameter.
Exceptions:
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid association.

Implements bpp::ParameterAliasable.

Definition at line 103 of file AbstractParameterAliasable.cpp.

References bpp::Parameter::addParameterListener(), bpp::Parameter::getConstraint(), bpp::Constraint::getDescription(), and bpp::Parameter::hasConstraint().

Referenced by bpp::ParametrizableCollection< N >::addObject().

void AbstractParameterAliasable::aliasParameters ( std::map< std::string, std::string > &  unparsedParams,
bool  verbose 
) [virtual, inherited]

Create a copy of this object and send a pointer to it.

Returns:
A pointer toward the copy object.

Implements bpp::DiscreteDistribution.

Definition at line 91 of file GammaDiscreteDistribution.h.

References GammaDiscreteDistribution().

void bpp::AbstractParameterAliasable::deleteParameters_ ( const std::vector< std::string > &  names) [inline, protected, inherited]
void AbstractDiscreteDistribution::discretize ( ) [virtual, inherited]

Discretizes the distribution in equiprobable classes.

Implements bpp::DiscreteDistribution.

Reimplemented in bpp::MixtureOfDiscreteDistributions, bpp::InvariantMixedDiscreteDistribution, bpp::SimpleDiscreteDistribution, and bpp::ConstantDistribution.

Definition at line 307 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::bounds_, bpp::AbstractDiscreteDistribution::distribution_, bpp::DiscreteDistribution::Expectation(), bpp::IntervalConstraint::getLowerBound(), bpp::IntervalConstraint::getUpperBound(), bpp::AbstractDiscreteDistribution::intMinMax_, bpp::AbstractDiscreteDistribution::median_, bpp::AbstractDiscreteDistribution::numberOfCategories_, bpp::DiscreteDistribution::pProb(), bpp::AbstractDiscreteDistribution::precision(), bpp::DiscreteDistribution::qProb(), bpp::IntervalConstraint::strictLowerBound(), bpp::IntervalConstraint::strictUpperBound(), and bpp::NumConstants::TINY().

Referenced by bpp::BetaDiscreteDistribution::BetaDiscreteDistribution(), bpp::ExponentialDiscreteDistribution::ExponentialDiscreteDistribution(), bpp::GaussianDiscreteDistribution::fireParameterChanged(), fireParameterChanged(), bpp::ExponentialDiscreteDistribution::fireParameterChanged(), bpp::BetaDiscreteDistribution::fireParameterChanged(), bpp::TruncatedExponentialDiscreteDistribution::fireParameterChanged(), GammaDiscreteDistribution(), bpp::GaussianDiscreteDistribution::GaussianDiscreteDistribution(), bpp::AbstractDiscreteDistribution::restrictToConstraint(), bpp::AbstractDiscreteDistribution::setMedian(), bpp::AbstractDiscreteDistribution::setNumberOfCategories(), bpp::TruncatedExponentialDiscreteDistribution::TruncatedExponentialDiscreteDistribution(), and bpp::UniformDiscreteDistribution::UniformDiscreteDistribution().

double GammaDiscreteDistribution::Expectation ( double  a) const [virtual]

Return a primitive function used for the expectation of the continuous version of the distribution, ie $ E(X|...<=X<a) = \int_{...}^a t.dProb(t) dt $.

Implements bpp::DiscreteDistribution.

Definition at line 123 of file GammaDiscreteDistribution.cpp.

References alpha_, beta_, ga1_, and bpp::RandomTools::pGamma().

void GammaDiscreteDistribution::fireParameterChanged ( const ParameterList parameters) [virtual]

Notify the class when one or several parameters have changed.

Parameters:
parametersA ParameterList object with parameters that changed.

Reimplemented from bpp::AbstractParameterAliasable.

Definition at line 98 of file GammaDiscreteDistribution.cpp.

References alpha_, beta_, bpp::AbstractDiscreteDistribution::discretize(), ga1_, bpp::AbstractParametrizable::getParameterValue(), and bpp::RandomTools::lnGamma().

virtual std::vector<std::string> bpp::ParameterAliasable::getAlias ( const std::string &  name) const [pure virtual, inherited]
Returns:
The list of names of the parameters that are aliased with a given parameter. Depending on the implementation, the function may be recursive or not...
Parameters:
nameThe name of the parameter to look for.

Implemented in bpp::AbstractParameterAliasable.

Referenced by bpp::ParametrizableCollection< N >::addObject(), and bpp::BppOParametrizableFormat::write().

vector< string > AbstractParameterAliasable::getAlias ( const std::string &  name) const [virtual, inherited]
Returns:
The list of names of the parameters that are aliased with a given parameter. The implementation is recursive, which means that in the case of A->B->C, getalias(C) will return both A and B.
Parameters:
nameThe name of the parameter to look for.

Implements bpp::ParameterAliasable.

Definition at line 245 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, and bpp::VectorTools::append().

Referenced by bpp::ParametrizableCollection< N >::removeObject().

Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list.

Definition at line 266 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::AbstractParametrizable::getParameter(), and bpp::ParameterList::hasParameter().

Vdouble AbstractDiscreteDistribution::getCategories ( ) const [virtual, inherited]
Returns:
A vector with all classes values.

Implements bpp::DiscreteDistribution.

Definition at line 142 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

double AbstractDiscreteDistribution::getCategory ( size_t  categoryIndex) const [virtual, inherited]
Parameters:
categoryIndexClass index.
Returns:
The value associated to a given class.

Implements bpp::DiscreteDistribution.

Definition at line 111 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

Referenced by bpp::BppODiscreteDistributionFormat::write().

string AbstractParameterAliasable::getFrom ( const std::string &  name) const [inherited]
Returns:
The name of the parameter from which a given parameter is aliased.
Parameters:
nameThe name of the parameter to look for.

Definition at line 306 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_.

double AbstractDiscreteDistribution::getIInfCumulativeProbability ( double  category) const [virtual, inherited]
Returns:
$Pr(x \leq \mbox{category})$.
Parameters:
categoryThe class value.

Implements bpp::DiscreteDistribution.

Definition at line 230 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

virtual const ParameterList& bpp::ParameterAliasable::getIndependentParameters ( ) const [pure virtual, inherited]

Get the minimal list of parameters to set the model.

If no parameters are aliased, this is the same a getParameters().

Returns:
A minimal set of parameters.

Implemented in bpp::AbstractParameterAliasable.

Referenced by bpp::InvariantMixedDiscreteDistribution::InvariantMixedDiscreteDistribution(), bpp::BppODiscreteDistributionFormat::write(), and bpp::BppOParametrizableFormat::write().

const ParameterList& bpp::AbstractParameterAliasable::getIndependentParameters ( ) const [inline, virtual, inherited]

Get the minimal list of parameters to set the model.

If no parameters are aliased, this is the same a getParameters().

Returns:
A minimal set of parameters.

Implements bpp::ParameterAliasable.

Definition at line 162 of file AbstractParameterAliasable.h.

References bpp::AbstractParameterAliasable::independentParameters_.

double AbstractDiscreteDistribution::getInfCumulativeProbability ( double  category) const [virtual, inherited]
Returns:
$Pr(x < \mbox{category})$.
Parameters:
categoryThe class value.

Implements bpp::DiscreteDistribution.

Definition at line 215 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

std::string bpp::GammaDiscreteDistribution::getName ( ) const [inline, virtual]

Get the name of the distribution.

Returns:
The name of this distribution.

Implements bpp::DiscreteDistribution.

Definition at line 67 of file GammaDiscreteDistribution.h.

std::string bpp::AbstractParametrizable::getNamespace ( ) const [inline, virtual, inherited]
virtual std::string bpp::Parametrizable::getNamespace ( ) const [pure virtual, inherited]
Returns:
The current namespace used. This is an empty string if no namespace is currently defined.

Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getNamespace().

size_t AbstractDiscreteDistribution::getNumberOfCategories ( ) const [virtual, inherited]
Returns:
The number of categories.

Implements bpp::DiscreteDistribution.

Definition at line 91 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::numberOfCategories_.

Referenced by bpp::BppODiscreteDistributionFormat::write().

virtual size_t bpp::ParameterAliasable::getNumberOfIndependentParameters ( ) const [pure virtual, inherited]

Get the number of independent parameters.

Returns:
The number of independent parameters. If no parameters are aliased, this is equivalent to the getNumberOfParameters() method.

Implemented in bpp::AbstractParameterAliasable.

size_t bpp::AbstractParameterAliasable::getNumberOfIndependentParameters ( ) const [inline, virtual, inherited]

Get the number of independent parameters.

Returns:
The number of independent parameters. If no parameters are aliased, this is equivalent to the getNumberOfParameters() method.

Implements bpp::ParameterAliasable.

Definition at line 164 of file AbstractParameterAliasable.h.

References bpp::AbstractParameterAliasable::independentParameters_, and bpp::ParameterList::size().

virtual size_t bpp::Parametrizable::getNumberOfParameters ( ) const [pure virtual, inherited]

Get the number of parameters.

See also:
getNumberOfIndependentParameters If some parameters are aliased.
Returns:
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.

Parameters:
nameThe name of the parameter to look for.
Returns:
The parameter with given name.
Exceptions:
ParameterNotFoundExceptionif no parameter with this name is found.

Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameter().

const Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index) const throw (IndexOutOfBoundsException) [inline, protected, inherited]
std::string AbstractParametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const [virtual, inherited]

Resolves a parameter name according to the current namespace.

Returns:
The parameter name without the namespace prefix, if any.

Implements bpp::Parametrizable.

Definition at line 63 of file AbstractParametrizable.cpp.

References bpp::TextTools::startsWith().

virtual std::string bpp::Parametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const [pure virtual, inherited]

Resolves a parameter name according to the current namespace.

Returns:
The parameter name without the namespace prefix, if any.

Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameterNameWithoutNamespace(), bpp::BppODiscreteDistributionFormat::read(), and bpp::BppOParametrizableFormat::write().

const ParameterList& bpp::AbstractParametrizable::getParameters ( ) const [inline, virtual, inherited]

Get all parameters available.

See also:
getIndependentParameters if some parameters are aliased.
Returns:
A list with all parameters available.

Implements bpp::Parametrizable.

Definition at line 77 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameters_.

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::AbstractParameterAliasable::fireParameterChanged(), bpp::MixtureOfDiscreteDistributions::MixtureOfDiscreteDistributions(), and bpp::ParametrizableCollection< N >::removeObject().

virtual const ParameterList& bpp::Parametrizable::getParameters ( ) const [pure virtual, inherited]
virtual double bpp::Parametrizable::getParameterValue ( const std::string &  name) const throw (ParameterNotFoundException) [pure virtual, inherited]

Get the value for parameter of name 'name'.

Parameters:
nameThe name of the parameter.
Returns:
the value of parameter name.

Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::getParameterValue(), and bpp::BppODiscreteDistributionFormat::read().

Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name) throw (ParameterNotFoundException) [inline, protected, inherited]
Parameters:
nameThe name of the parameter, including its namespace.
Returns:
A reference toward the corresponding parameter.
Exceptions:
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 185 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_().

const Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name) const throw (ParameterNotFoundException) [inline, protected, inherited]
Parameters:
nameThe name of the parameter, including its namespace.
Returns:
A reference toward the corresponding parameter.
Exceptions:
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 194 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter().

Returns:
A vector with all probabilities.

Implements bpp::DiscreteDistribution.

Definition at line 158 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

double AbstractDiscreteDistribution::getProbability ( size_t  categoryIndex) const [virtual, inherited]
Parameters:
categoryIndexClass index.
Returns:
The probability associated to a given class.

Implements bpp::DiscreteDistribution.

Definition at line 123 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

Referenced by bpp::BppODiscreteDistributionFormat::write().

double AbstractDiscreteDistribution::getProbability ( double  category) const [virtual, inherited]
Parameters:
categoryThe value associated to the class.
Returns:
The probability associated to a given class.

Implements bpp::DiscreteDistribution.

Definition at line 135 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

double AbstractDiscreteDistribution::getSSupCumulativeProbability ( double  category) const [virtual, inherited]
Returns:
$Pr(x \geq \mbox{category})$.
Parameters:
categoryThe class value.

Implements bpp::DiscreteDistribution.

Definition at line 264 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

double AbstractDiscreteDistribution::getSupCumulativeProbability ( double  category) const [virtual, inherited]
Returns:
$Pr(x > \mbox{category})$.
Parameters:
categoryThe class value.

Implements bpp::DiscreteDistribution.

Definition at line 247 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

double AbstractDiscreteDistribution::getValueCategory ( double  value) const [virtual, inherited]
virtual bool bpp::Parametrizable::hasParameter ( const std::string &  name) const [pure virtual, inherited]

Tell if there is a parameter with specified name.

Parameters:
nameThe name of the parameter to look for.
Returns:
y/n.

Implemented in bpp::FunctionWrapper, bpp::ParametrizableAdapter, and bpp::AbstractParametrizable.

Referenced by bpp::FunctionWrapper::hasParameter().

bool bpp::AbstractParametrizable::hasParameter ( const std::string &  name) const [inline, virtual, inherited]

Tell if there is a parameter with specified name.

Parameters:
nameThe name of the parameter to look for.
Returns:
y/n.

Implements bpp::Parametrizable.

Definition at line 75 of file AbstractParametrizable.h.

References bpp::ParameterList::hasParameter(), bpp::AbstractParametrizable::parameters_, and bpp::AbstractParametrizable::prefix_.

bool bpp::AbstractParametrizable::matchParametersValues ( const ParameterList parameters) throw (ConstraintException) [inline, virtual, inherited]

Update the parameters from parameters.

Only common parameters with parameters will be updated.

Parameters:
parametersA list of parameters.
Returns:
True if at least one parameter value has been changed.
Exceptions:
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 111 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::ParameterList::matchParametersValues(), and bpp::AbstractParametrizable::parameters_.

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::Simplex::setFrequencies(), bpp::ReparametrizationFunctionWrapper::setParameters(), bpp::TestFunction::setParameters(), and bpp::FullHmmTransitionMatrix::setTransitionProbabilities().

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:
parametersA list of parameters.
Returns:
True if at least one parameter value has been changed.
Exceptions:
ConstraintExceptionIf 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().

GammaDiscreteDistribution & GammaDiscreteDistribution::operator= ( const GammaDiscreteDistribution gdd)

Definition at line 83 of file GammaDiscreteDistribution.cpp.

References alpha_, beta_, and ga1_.

double GammaDiscreteDistribution::pProb ( double  x) const [virtual]

Return the cumulative quantile of the continuous version of the distribution, ie $ Prob(X<x) $.

Implements bpp::DiscreteDistribution.

Definition at line 118 of file GammaDiscreteDistribution.cpp.

References alpha_, beta_, and bpp::RandomTools::pGamma().

void AbstractDiscreteDistribution::print ( OutputStream out) const [virtual, inherited]

Print the distribution (categories and corresponding probabilities) to a stream.

Parameters:
outThe outstream where to print the distribution.

Implements bpp::DiscreteDistribution.

Definition at line 279 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

double GammaDiscreteDistribution::qProb ( double  x) const [virtual]

Return the quantile of the continuous version of the distribution, ie y such that $ Prob(X<y)=x $.

Implements bpp::DiscreteDistribution.

Definition at line 112 of file GammaDiscreteDistribution.cpp.

References alpha_, beta_, and bpp::RandomTools::qGamma().

double AbstractDiscreteDistribution::rand ( ) const [virtual, inherited]

Draw a random number from this distribution.

This number will be one of the class values, drawn according to the class probabilities.

Returns:
A random number according to this distribution.

Implements bpp::DiscreteDistribution.

Definition at line 197 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_, and bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry().

double bpp::GammaDiscreteDistribution::randC ( ) const throw (Exception) [inline, virtual]

Draw a random number from the continuous version of this distribution, if it exists.

Uses the continuous version of this distribution to draw a random number.

Returns:
A random number according to this distribution.
Exceptions:
ExceptionIf there is no continuous version of this distribution.

Reimplemented from bpp::AbstractDiscreteDistribution.

Definition at line 95 of file GammaDiscreteDistribution.h.

References bpp::AbstractParametrizable::getParameterValue(), bpp::AbstractDiscreteDistribution::intMinMax_, bpp::IntervalConstraint::isCorrect(), and bpp::RandomTools::randGamma().

void AbstractDiscreteDistribution::restrictToConstraint ( const Constraint c) [virtual, inherited]

Restricts the distribution to the domain where the constraint is respected, in addition of other predefined constraints.

Parameters:
cThe Constraint to respect.

Implements bpp::DiscreteDistribution.

Reimplemented in bpp::MixtureOfDiscreteDistributions, bpp::SimpleDiscreteDistribution, bpp::InvariantMixedDiscreteDistribution, bpp::TruncatedExponentialDiscreteDistribution, and bpp::ConstantDistribution.

Definition at line 454 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::discretize(), and bpp::AbstractDiscreteDistribution::intMinMax_.

void AbstractDiscreteDistribution::set ( double  category,
double  probability 
) [virtual, inherited]

Set the probability associated to a class.

If the category does not exist, a new category is created with the corresponding probability. If the category already exist, its probability is set to 'probability'. The sum of all probabilities is not checked.

Parameters:
categoryThe class value.
probabilityThe class probability.

Implements bpp::DiscreteDistribution.

Definition at line 174 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::distribution_.

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:
parametersA list with all parameters.
Exceptions:
ParameterNotFoundExceptionIf a some parameter in the list is not in params.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 90 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::AbstractParametrizable::parameters_, and bpp::ParameterList::setAllParametersValues().

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:
parametersA list with all parameters.
Exceptions:
ParameterNotFoundExceptionIf a some parameter in the list is not in params.
ConstraintExceptionIf 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().

void bpp::AbstractDiscreteDistribution::setMedian ( bool  median) [inline, virtual, inherited]

Sets the median value to true to say that the value in a class is proportional to the median value of the class, the proportionality factor being such that the sum of the values equals the expectation of the distribution. If it is set to false, the value is the mean value in the class.

If the median value is modified, the discretization process is launched.

Parameters:
mediantells how the value associated to each class is computed.

Implements bpp::DiscreteDistribution.

Reimplemented in bpp::MixtureOfDiscreteDistributions, and bpp::InvariantMixedDiscreteDistribution.

Definition at line 218 of file AbstractDiscreteDistribution.h.

References bpp::AbstractDiscreteDistribution::discretize(), and bpp::AbstractDiscreteDistribution::median_.

void AbstractParameterAliasable::setNamespace ( const std::string &  prefix) [virtual, inherited]

Set the namespace for the parameter names.

Parameters:
prefixThe '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.

Reimplemented in bpp::MixtureOfDiscreteDistributions, and bpp::InvariantMixedDiscreteDistribution.

Definition at line 218 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::AbstractParametrizable::getNamespace(), bpp::AbstractParameterAliasable::independentParameters_, bpp::ParameterList::size(), and bpp::TextTools::startsWith().

virtual void bpp::Parametrizable::setNamespace ( const std::string &  prefix) [pure virtual, inherited]

Set the namespace for the parameter names.

Parameters:
prefixThe '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().

void AbstractDiscreteDistribution::setNumberOfCategories ( size_t  nbClasses) [virtual, inherited]

sets the number of categories and discretizes if there is a change in this number.

Implements bpp::DiscreteDistribution.

Reimplemented in bpp::MixtureOfDiscreteDistributions.

Definition at line 96 of file AbstractDiscreteDistribution.cpp.

References bpp::AbstractDiscreteDistribution::discretize(), and bpp::AbstractDiscreteDistribution::numberOfCategories_.

void bpp::AbstractParametrizable::setParametersValues ( const ParameterList parameters) throw (ParameterNotFoundException, ConstraintException) [inline, virtual, inherited]

Update the parameters from parameters.

parameters must be a subset of all parameters available.

Parameters:
parametersA list containing all parameters to update.
Exceptions:
ParameterNotFoundExceptionIf a some parameter in params is not in the list.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 104 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::AbstractParametrizable::parameters_, and bpp::ParameterList::setParametersValues().

Referenced by bpp::LowMemoryRescaledHmmLikelihood::setParameters(), bpp::LogsumHmmLikelihood::setParameters(), and bpp::RescaledHmmLikelihood::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:
parametersA list containing all parameters to update.
Exceptions:
ParameterNotFoundExceptionIf a some parameter in params is not in the list.
ConstraintExceptionIf 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().

void bpp::AbstractParametrizable::setParameterValue ( const std::string &  name,
double  value 
) throw (ParameterNotFoundException, ConstraintException) [inline, virtual, inherited]

Set the value of parameter with name name to be equal to value.

Parameters:
namethe name of the parameter to set.
valueThe value of the parameter.
Exceptions:
ParameterNotFoundExceptionIf no parameter in the list has the name name.
ConstraintExceptionIf value does not match the constraint associated to parameter name.

Implements bpp::Parametrizable.

Definition at line 97 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::AbstractParametrizable::parameters_, bpp::AbstractParametrizable::prefix_, bpp::ParameterList::setParameterValue(), and bpp::ParameterList::subList().

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.

Parameters:
namethe name of the parameter to set.
valueThe value of the parameter.
Exceptions:
ParameterNotFoundExceptionIf no parameter in the list has the name name.
ConstraintExceptionIf 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().

bool bpp::AbstractDiscreteDistribution::strictLowerBound ( ) const [inline, virtual, inherited]
bool bpp::AbstractDiscreteDistribution::strictUpperBound ( ) const [inline, virtual, inherited]
Returns:
The highest value.

Reimplemented from bpp::DiscreteDistribution.

Definition at line 207 of file AbstractDiscreteDistribution.h.

References bpp::AbstractDiscreteDistribution::intMinMax_, and bpp::IntervalConstraint::strictUpperBound().

virtual void bpp::ParameterAliasable::unaliasParameters ( const std::string &  p1,
const std::string &  p2 
) throw (ParameterNotFoundException, Exception) [pure virtual, inherited]

Detach two parameters previously set as 'aliased'.

The values of the two parameters will now be independent.

Parameters:
p1Original parameter.
p2Aliased parameter.
Exceptions:
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid dissociation.

Implemented in bpp::AbstractParameterAliasable.

void AbstractParameterAliasable::unaliasParameters ( const std::string &  p1,
const std::string &  p2 
) throw (ParameterNotFoundException, Exception) [virtual, inherited]

Detach two parameters previously set as 'aliased'.

The values of the two parameters will now be independent.

Parameters:
p1Original parameter.
p2Aliased parameter.
Exceptions:
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid dissociation.

Implements bpp::ParameterAliasable.

Definition at line 198 of file AbstractParameterAliasable.cpp.

Referenced by bpp::ParametrizableCollection< N >::removeObject().


Member Data Documentation

std::map<double, double, Order> bpp::AbstractDiscreteDistribution::distribution_ [protected, inherited]

These fields must be initialized in the constructor of the derived classes.

Definition at line 115 of file AbstractDiscreteDistribution.h.

Referenced by bpp::AbstractDiscreteDistribution::add(), bpp::ConstantDistribution::ConstantDistribution(), bpp::SimpleDiscreteDistribution::discretize(), bpp::AbstractDiscreteDistribution::discretize(), bpp::SimpleDiscreteDistribution::Expectation(), bpp::ConstantDistribution::fireParameterChanged(), bpp::SimpleDiscreteDistribution::fireParameterChanged(), bpp::AbstractDiscreteDistribution::getCategories(), bpp::AbstractDiscreteDistribution::getCategory(), bpp::AbstractDiscreteDistribution::getIInfCumulativeProbability(), bpp::AbstractDiscreteDistribution::getInfCumulativeProbability(), bpp::SimpleDiscreteDistribution::getLowerBound(), bpp::AbstractDiscreteDistribution::getProbabilities(), bpp::AbstractDiscreteDistribution::getProbability(), bpp::AbstractDiscreteDistribution::getSSupCumulativeProbability(), bpp::AbstractDiscreteDistribution::getSupCumulativeProbability(), bpp::SimpleDiscreteDistribution::getUpperBound(), bpp::AbstractDiscreteDistribution::getValueCategory(), bpp::AbstractDiscreteDistribution::operator=(), bpp::SimpleDiscreteDistribution::pProb(), bpp::AbstractDiscreteDistribution::precision(), bpp::AbstractDiscreteDistribution::print(), bpp::SimpleDiscreteDistribution::qProb(), bpp::AbstractDiscreteDistribution::rand(), bpp::SimpleDiscreteDistribution::restrictToConstraint(), bpp::AbstractDiscreteDistribution::set(), bpp::SimpleDiscreteDistribution::SimpleDiscreteDistribution(), bpp::InvariantMixedDiscreteDistribution::updateDistribution(), and bpp::MixtureOfDiscreteDistributions::updateDistribution().

the interval where the distribution is defined/restricted.

Definition at line 124 of file AbstractDiscreteDistribution.h.

Referenced by bpp::BetaDiscreteDistribution::BetaDiscreteDistribution(), bpp::AbstractDiscreteDistribution::discretize(), bpp::ExponentialDiscreteDistribution::ExponentialDiscreteDistribution(), bpp::BetaDiscreteDistribution::fireParameterChanged(), bpp::TruncatedExponentialDiscreteDistribution::fireParameterChanged(), bpp::SimpleDiscreteDistribution::fireParameterChanged(), GammaDiscreteDistribution(), bpp::AbstractDiscreteDistribution::getLowerBound(), bpp::AbstractDiscreteDistribution::getUpperBound(), bpp::AbstractDiscreteDistribution::getValueCategory(), bpp::AbstractDiscreteDistribution::operator=(), bpp::UniformDiscreteDistribution::randC(), randC(), bpp::ExponentialDiscreteDistribution::randC(), bpp::BetaDiscreteDistribution::randC(), bpp::TruncatedExponentialDiscreteDistribution::randC(), bpp::ConstantDistribution::restrictToConstraint(), bpp::TruncatedExponentialDiscreteDistribution::restrictToConstraint(), bpp::SimpleDiscreteDistribution::restrictToConstraint(), bpp::AbstractDiscreteDistribution::restrictToConstraint(), bpp::AbstractDiscreteDistribution::strictLowerBound(), bpp::AbstractDiscreteDistribution::strictUpperBound(), bpp::TruncatedExponentialDiscreteDistribution::TruncatedExponentialDiscreteDistribution(), bpp::UniformDiscreteDistribution::UniformDiscreteDistribution(), bpp::InvariantMixedDiscreteDistribution::updateDistribution(), and bpp::MixtureOfDiscreteDistributions::updateDistribution().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends