![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Class for discretized random variable. More...
#include <discretizedVariable.h>
Public Member Functions | |
| DiscretizedVariable< T_TICKS > * | clone () const override |
| a virtual clone | |
| VarType | varType () const override |
| returns the type of variable | |
| DiscretizedVariable< T_TICKS > & | operator= (const DiscretizedVariable< T_TICKS > &aDRV) |
| operator = | |
| bool | isTick (const T_TICKS &aTick) const |
| DiscretizedVariable & | addTick (const T_TICKS &aTick) |
| add a tick. | |
| void | eraseTicks () |
| erase all the Ticks | |
| std::string | label (Idx i) const override |
| double | numerical (Idx indice) const override |
| get a (deterministic) numerical representation of he indice-the value. | |
| double | draw (Idx indice) const override |
| get a random value in the intervall indice | |
| Idx | index (const std::string &label) const override |
| from the label to its index in var. | |
| Idx | index (const T_TICKS tick) const |
| from the T+TICKS to its index in var. | |
| Size | domainSize () const override |
| std::string | domain () const override |
| string represent the domain of the variable | |
| std::string | stype () const override final |
| string represent the type of the variable | |
| const T_TICKS & | tick (Idx i) const |
| from the index to the tick. | |
| const std::vector< T_TICKS > & | ticks () const |
| Return the list of ticks. | |
| std::vector< double > | ticksAsDoubles () const override |
| return the list of ticks as a vector of doubles | |
| Idx | closestIndex (double val) const override |
| returns the closest index of the value | |
| std::string | toFast () const override |
| Idx | operator[] (const std::string &label) const |
| from the label to its index in var. | |
| std::string | toString () const |
| string version of *this | |
| std::string | toStringWithDescription () const |
| string version of *this using description attribute instead of name. | |
constructors & destructors | |
| DiscretizedVariable (const std::string &aName, const std::string &aDesc) | |
| Constructor. | |
| DiscretizedVariable (const std::string &aName, const std::string &aDesc, const std::vector< T_TICKS > &ticks, bool is_empirical=false) | |
| Constructor. | |
| DiscretizedVariable (const DiscretizedVariable< T_TICKS > &aDRV) | |
| Copy constructor. | |
| ~DiscretizedVariable () override final | |
| Destructor. | |
Accessors / Modifiers | |
| bool | isEmpirical () const final |
| void | setEmpirical (bool state) |
Accessors / Modifiers | |
| bool | empty () const |
| std::vector< std::string > | labels () const |
| vector of labels | |
| std::string | closestLabel (double val) const |
| for numerical variables, returns the closest label for the value | |
Operators | |
| bool | operator== (const Variable &aRV) const |
| equality operator | |
Accessors / Modifiers | |
| void | setName (const std::string &theValue) |
| sets the name of the variable | |
| const std::string & | name () const |
| returns the name of the variable | |
| void | setDescription (const std::string &theValue) const |
| sets the description of the variable | |
| const std::string & | description () const |
| returns the description of the variable | |
Protected Member Functions | |
| void | copy_ (const DiscretizedVariable< T_TICKS > &aDRV) |
| make a copy | |
| Idx | pos_ (const T_TICKS &target) const |
| search the class of target (internally use dichotomy_) | |
| void | copy_ (const Variable &aRV) |
| protected copy | |
Protected Attributes | |
| bool | _is_empirical |
Private Member Functions | |
| bool | _checkSameDomain_ (const Variable &aRV) const override |
| check the domain | |
Private Attributes | |
| std::vector< T_TICKS > | _ticks_ |
| std::string | _name_ |
| the name of the variable | |
| std::string | _description_ |
| the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference. | |
Class for discretized random variable.
a DiscretizedVariable contains a vector of T_TICKS, assuming that the modalities of the variable arc [T1,T2[,[T2,T3[,...,[Tn-1,Tn]. T can be plus_infinity or minus_infinity.
operator [] has a T_TICKS argument.
Definition at line 76 of file discretizedVariable.h.
| gum::DiscretizedVariable< T_TICKS >::DiscretizedVariable | ( | const std::string & | aName, |
| const std::string & | aDesc ) |
Constructor.
| aName | the name |
| aDesc | the description |
Referenced by DiscretizedVariable(), addTick(), clone(), copy_(), and operator=().
| gum::DiscretizedVariable< T_TICKS >::DiscretizedVariable | ( | const std::string & | aName, |
| const std::string & | aDesc, | ||
| const std::vector< T_TICKS > & | ticks, | ||
| bool | is_empirical = false ) |
Constructor.
| aName | the name |
| aDesc | the description |
| ticks | list of ticks (limits of the intervals of the discretization) |
| is_empirical | determine the behavior of the variable for value below or above the limits. If false, it is treated as an error. |
References ticks().
| gum::DiscretizedVariable< T_TICKS >::DiscretizedVariable | ( | const DiscretizedVariable< T_TICKS > & | aDRV | ) |
Copy constructor.
| aDRV |
References DiscretizedVariable().
|
finaloverride |
Destructor.
|
overrideprivatevirtual |
check the domain
this function use the assumption that the concrete type of the variable is the same as *this
Implements gum::Variable.
| DiscretizedVariable & gum::DiscretizedVariable< T_TICKS >::addTick | ( | const T_TICKS & | aTick | ) |
add a tick.
| aTick |
| DefaultInLabel |
References DiscretizedVariable(), and addTick().
Referenced by addTick(), and gum::prm::PRMFactory< GUM_SCALAR >::addTick().
|
overridevirtual |
a virtual clone
Implements gum::IDiscretizedVariable.
References DiscretizedVariable(), and clone().
Referenced by clone().
|
overridevirtual |
returns the closest index of the value
Implements gum::DiscreteVariable.
|
inherited |
for numerical variables, returns the closest label for the value
|
protected |
make a copy
| aDRV | the copied object |
References DiscretizedVariable().
|
protectedinherited |
protected copy
| aRV | to be copied |
References Variable().
|
inherited |
returns the description of the variable
|
overridevirtual |
string represent the domain of the variable
Implements gum::DiscreteVariable.
References domain().
Referenced by domain().
|
overridevirtual |
Implements gum::DiscreteVariable.
References domainSize().
Referenced by domainSize().
|
overridevirtual |
get a random value in the intervall indice
Implements gum::IDiscretizedVariable.
References draw().
Referenced by draw().
|
inherited |
| void gum::DiscretizedVariable< T_TICKS >::eraseTicks | ( | ) |
erase all the Ticks
References eraseTicks().
Referenced by eraseTicks().
|
overridevirtual |
| Idx gum::DiscretizedVariable< T_TICKS >::index | ( | const T_TICKS | tick | ) | const |
|
finalvirtualinherited |
Reimplemented from gum::DiscreteVariable.
| bool gum::DiscretizedVariable< T_TICKS >::isTick | ( | const T_TICKS & | aTick | ) | const |
|
overridevirtual |
| i |
| OutOfBound |
Implements gum::DiscreteVariable.
References label().
Referenced by index(), and label().
|
inherited |
vector of labels
Referenced by gum::LabelizedVariable::LabelizedVariable().
|
inherited |
returns the name of the variable
Referenced by gum::learning::IBNLearner::Database::Database(), gum::Estimator< GUM_SCALAR >::Estimator(), gum::MultiDimImplementation< double >::MultiDimImplementation(), gum::NumericalDiscreteVariable::NumericalDiscreteVariable(), gum::BNdistance< GUM_SCALAR >::_checkCompatibility_(), gum::BayesNet< double >::_copyTensors_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveCommonType_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveInputs_(), gum::BayesNetFactory< GUM_SCALAR >::_setCPTAndParents_(), gum::Instantiation::add(), gum::FMDP< double >::addCostForAction(), gum::FMDP< GUM_SCALAR >::addVariable(), gum::MultiDimICIModel< GUM_SCALAR >::causalWeight(), gum::Instantiation::chgVal(), gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::InfluenceDiagram< GUM_SCALAR >::copyStructureAndTables_(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::BayesNetFactory< GUM_SCALAR >::endVariableDeclaration(), gum::FMDPFactory< GUM_SCALAR >::endVariableDeclaration(), gum::Tensor< GUM_SCALAR >::fillWith(), gum::BayesNetFragment< GUM_SCALAR >::nodeId(), gum::Estimator< GUM_SCALAR >::posterior(), gum::Estimator< GUM_SCALAR >::setFromBN(), gum::Instantiation::setValsFrom(), gum::BayesNetFactory< GUM_SCALAR >::setVariable(), gum::BayesNetFactory< GUM_SCALAR >::setVariableValuesUnchecked(), gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::toDot(), gum::RangeVariable::toFast(), gum::Estimator< GUM_SCALAR >::update(), and gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::varNodeListe().
|
overridevirtual |
get a (deterministic) numerical representation of he indice-the value.
Implements gum::DiscreteVariable.
References numerical().
Referenced by numerical().
| DiscretizedVariable< T_TICKS > & gum::DiscretizedVariable< T_TICKS >::operator= | ( | const DiscretizedVariable< T_TICKS > & | aDRV | ) |
operator =
| aDRV | a labelized discrete random variable |
References DiscretizedVariable().
|
inlineinherited |
from the label to its index in var.
| NotFound |
Definition at line 156 of file discreteVariable.h.
References index(), and label().
|
protected |
search the class of target (internally use dichotomy_)
| target |
|
inherited |
sets the description of the variable
| theValue |
|
inherited |
| state | : change the variabl to empirical or not |
References setEmpirical().
Referenced by setEmpirical().
|
inherited |
sets the name of the variable
| theValue |
|
inlinefinaloverridevirtual |
string represent the type of the variable
Implements gum::DiscreteVariable.
Definition at line 193 of file discretizedVariable.h.
References stype().
Referenced by stype().
| const T_TICKS & gum::DiscretizedVariable< T_TICKS >::tick | ( | Idx | i | ) | const |
| const std::vector< T_TICKS > & gum::DiscretizedVariable< T_TICKS >::ticks | ( | ) | const |
Return the list of ticks.
Referenced by DiscretizedVariable().
|
overridevirtual |
return the list of ticks as a vector of doubles
Implements gum::IDiscretizedVariable.
|
overridevirtual |
Implements gum::DiscreteVariable.
|
inherited |
string version of *this
Referenced by gum::IntegerVariable::IntegerVariable(), and gum::BNdistance< GUM_SCALAR >::_checkCompatibility_().
|
inherited |
string version of *this using description attribute instead of name.
|
overridevirtual |
returns the type of variable
Implements gum::DiscreteVariable.
References varType().
Referenced by varType().
|
mutableprivateinherited |
the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference.
Definition at line 165 of file variable.h.
|
protectedinherited |
Definition at line 112 of file IDiscretizedVariable.h.
|
privateinherited |
the name of the variable
Definition at line 160 of file variable.h.
|
private |
Definition at line 78 of file discretizedVariable.h.