![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
A base class for discretized variables, independent of the ticks type. More...
#include <agrum/base/variables/IDiscretizedVariable.h>
Public Member Functions | |
| Idx | operator[] (const std::string &label) const |
| from the label to its index in var. | |
| virtual Idx | index (const std::string &label) const =0 |
| virtual std::string | label (Idx i) const =0 |
| get the indice-th label. This method is pure virtual. | |
| std::string | toString () const |
| string version of *this | |
| std::string | toStringWithDescription () const |
| string version of *this using description attribute instead of name. | |
| std::string | domain () const override=0 |
| string represent the domain of the variable | |
| virtual std::string | stype () const =0 |
| string represent the type of the variable | |
Constructors / Destructors | |
| IDiscretizedVariable (const std::string &aName, const std::string &aDesc) | |
| Default constructor. | |
| IDiscretizedVariable (const IDiscretizedVariable &from) | |
| Copy Constructor. | |
| virtual | ~IDiscretizedVariable () |
| destructor | |
| IDiscretizedVariable * | clone () const =0 |
| Copy Factory. | |
Accessors / Modifiers | |
| bool | isEmpirical () const final |
| void | setEmpirical (bool state) |
| virtual std::vector< double > | ticksAsDoubles () const =0 |
| return the list of ticks as a vector of doubles | |
| virtual double | draw (Idx indice) const =0 |
| get a (double) random value in the intervall indice | |
Accessors / Modifiers | |
| bool | empty () const |
| virtual Size | domainSize () const =0 |
| std::vector< std::string > | labels () const |
| vector of labels | |
| virtual double | numerical (Idx indice) const =0 |
| get a numerical representation of the indice-th value. | |
| virtual Idx | closestIndex (double val) const =0 |
| for numerical variables, returns the closest index for the value | |
| std::string | closestLabel (double val) const |
| for numerical variables, returns the closest label for the value | |
| VarType | varType () const override=0 |
| returns the varType of variable | |
| virtual std::string | toFast () const =0 |
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 | |
| IDiscretizedVariable & | operator= (const IDiscretizedVariable &from) |
| copy operator | |
| void | copy_ (const Variable &aRV) |
| protected copy | |
Protected Attributes | |
| bool | _is_empirical |
Private Member Functions | |
| virtual bool | _checkSameDomain_ (const Variable &aRV) const =0 |
| check the domain | |
Private Attributes | |
| 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. | |
A base class for discretized variables, independent of the ticks type.
Definition at line 59 of file IDiscretizedVariable.h.
| gum::IDiscretizedVariable::IDiscretizedVariable | ( | const std::string & | aName, |
| const std::string & | aDesc ) |
Default constructor.
Referenced by IDiscretizedVariable(), clone(), and operator=().
| gum::IDiscretizedVariable::IDiscretizedVariable | ( | const IDiscretizedVariable & | from | ) |
Copy Constructor.
If from has any listener, it will not be copied.
| from | the variable we copy |
References IDiscretizedVariable().
|
virtual |
destructor
|
privatepure virtualinherited |
check the domain
this function use the assumption that the concrete type of the variable is the same as *this
Implemented in gum::ContinuousVariable< GUM_SCALAR >, gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
References Variable().
|
pure virtual |
Copy Factory.
Implements gum::DiscreteVariable.
Implemented in gum::DiscretizedVariable< T_TICKS >.
References IDiscretizedVariable().
for numerical variables, returns the closest index for the value
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
Referenced by gum::Tensor< GUM_SCALAR >::evEq(), gum::Tensor< GUM_SCALAR >::evGt(), gum::Tensor< GUM_SCALAR >::evIn(), and gum::Tensor< GUM_SCALAR >::evLt().
|
inherited |
for numerical variables, returns the closest label for the value
|
protectedinherited |
protected copy
| aRV | to be copied |
References Variable().
|
inherited |
returns the description of the variable
|
overridepure virtualinherited |
string represent the domain of the variable
Implements gum::Variable.
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
|
pure virtualinherited |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
Referenced by gum::Estimator< GUM_SCALAR >::Estimator(), gum::prm::ClassDependencyGraph< GUM_SCALAR >::_addNode_(), gum::MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy >::_checkIsomorphism_(), gum::TreeOperator< GUM_SCALAR, COMBINEOPERATOR, TerminalNodePolicy >::_checkRedundancy_(), gum::BayesNetFactory< GUM_SCALAR >::_checkVariableModality_(), gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_(), gum::StatesCounter::_incState_(), gum::StatesChecker::_insertState_(), gum::MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy >::_isRedundant_(), gum::StructuredPlaner< GUM_SCALAR >::_recurArgMaxCopy_(), gum::StructuredPlaner< GUM_SCALAR >::_recurExtractOptPol_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_verticesSampling_(), gum::AdaptiveRMaxPlaner::_visitLearner_(), gum::TreeOperator< GUM_SCALAR, COMBINEOPERATOR, TerminalNodePolicy >::_xPloreDT1_(), gum::TreeOperator< GUM_SCALAR, COMBINEOPERATOR, TerminalNodePolicy >::_xPloreDT2_(), gum::MultiDimArray< GUM_SCALAR >::add(), gum::MultiDimDecorator< GUM_SCALAR >::add(), gum::MultiDimWithOffset< GUM_SCALAR >::add(), gum::BayesNet< GUM_SCALAR >::addAND(), gum::BayesNet< GUM_SCALAR >::addEXISTS(), gum::BayesNet< GUM_SCALAR >::addFORALL(), gum::prm::PRMFactory< GUM_SCALAR >::addLabel(), gum::BayesNet< GUM_SCALAR >::addOR(), gum::InfluenceDiagram< GUM_SCALAR >::addUtilityNode(), gum::InternalNode::allocateNodeSons(), gum::aggregator::Median< GUM_SCALAR >::buildValue_(), gum::Instantiation::chgVal(), gum::MultiDimWithOffset< GUM_SCALAR >::computeInstantiationValue_(), gum::InternalNode::deallocateNodeSons(), gum::Instantiation::decVar(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::MultiDimArray< GUM_SCALAR >::erase(), gum::MultiDimImplementation< GUM_SCALAR >::erase(), gum::MultiDimWithOffset< GUM_SCALAR >::erase(), gum::Tensor< GUM_SCALAR >::evGt(), gum::credal::CredalNet< GUM_SCALAR >::fillConstraint(), gum::aggregator::MultiDimAggregator< GUM_SCALAR >::get(), gum::getMaxModality(), gum::Instantiation::incVar(), gum::MultiDimFunctionGraphManager< GUM_SCALAR, TerminalNodePolicy >::nodeRedundancyCheck_(), gum::MultiDimFunctionGraphProjector< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::project(), gum::MultiDimInterface::replace(), gum::VariableSelector::select(), gum::prm::PRMFactory< GUM_SCALAR >::setCPFByRule(), gum::prm::PRMFactory< GUM_SCALAR >::setCPFByRule(), gum::credal::CredalNet< GUM_SCALAR >::setCPT(), gum::Estimator< GUM_SCALAR >::setFromBN(), gum::Instantiation::setLastVar(), gum::prm::PRMFormAttribute< GUM_SCALAR >::swap(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::swap(), gum::prm::PRMFormAttribute< GUM_SCALAR >::type_(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::type_().
get a (double) random value in the intervall indice
Implemented in gum::DiscretizedVariable< T_TICKS >.
References draw().
Referenced by draw().
|
inherited |
|
pure virtualinherited |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
References label().
Referenced by gum::Tensor< GUM_SCALAR >::deterministicTensor(), and operator[]().
|
finalvirtual |
Reimplemented from gum::DiscreteVariable.
|
pure virtualinherited |
get the indice-th label. This method is pure virtual.
| indice | the index of the label we wish to return |
| OutOfBound |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkParameterValue_(), gum::BayesNetFactory< GUM_SCALAR >::_checkVariableModality_(), gum::learning::BNDatabaseGenerator< GUM_SCALAR >::_label_(), gum::prm::PRMFactory< GUM_SCALAR >::addLabel(), index(), gum::StructuredPlaner< double >::makePlanning(), operator[](), gum::prm::o3prmr::O3prmrInterpreter::query(), gum::prm::PRMFactory< GUM_SCALAR >::setCPFByRule(), gum::prm::PRMFactory< GUM_SCALAR >::setCPFByRule(), and gum::MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >::toDot().
|
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().
get a numerical representation of the indice-th value.
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
Referenced by gum::learning::BNDatabaseGenerator< GUM_SCALAR >::_label_().
|
protected |
|
inlineinherited |
from the label to its index in var.
| NotFound |
Definition at line 156 of file discreteVariable.h.
References index(), and label().
|
inherited |
sets the description of the variable
| theValue |
| void gum::IDiscretizedVariable::setEmpirical | ( | bool | state | ) |
| state | : change the variabl to empirical or not |
References setEmpirical().
Referenced by setEmpirical().
|
inherited |
sets the name of the variable
| theValue |
|
pure virtualinherited |
string represent the type of the variable
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
|
pure virtual |
return the list of ticks as a vector of doubles
Implemented in gum::DiscretizedVariable< T_TICKS >.
References ticksAsDoubles().
Referenced by ticksAsDoubles().
|
pure virtualinherited |
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
|
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.
|
overridepure virtualinherited |
returns the varType of variable
Implements gum::Variable.
Implemented in gum::DiscretizedVariable< T_TICKS >, gum::IntegerVariable, gum::LabelizedVariable, gum::NumericalDiscreteVariable, and gum::RangeVariable.
Referenced by gum::learning::BNDatabaseGenerator< GUM_SCALAR >::_label_().
|
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.
|
protected |
Definition at line 112 of file IDiscretizedVariable.h.
|
privateinherited |
the name of the variable
Definition at line 160 of file variable.h.