aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::learning::DBTranslatedValue Union Reference

The union class for storing the translated values in learning databases. More...

#include <agrum/tools/database/DBTranslatedValue.h>

Public Attributes

std::size_t discr_val
 the field for storing discrete values More...
 
float cont_val
 the field for storing continuous values More...
 

Public Member Functions

Constructors / Destructors
constexpr DBTranslatedValue ()
 default constructor: stores discrete value 0 More...
 
constexpr DBTranslatedValue (const float &val)
 the constructor for storing a continuous value More...
 
constexpr DBTranslatedValue (const std::size_t &val)
 the constructor for storing a discrete value More...
 
 ~DBTranslatedValue ()
 destructor More...
 

Detailed Description

The union class for storing the translated values in learning databases.

In aGrUM, learning is performed on datasets that are preprocessed, i.e., their values are encoded in such a way that learning is fast. More precisely, the values of discrete random variables are encoded as integers ranging from 0 to the domain size minus 1 of the variable, and the values of continuous random variables are encoded as floating point numbers. Missing values are encoded as std::numeric_limits<>::max() over these types. The DBTranslatedValue class is the representation of these types.

Usage example:
// create a discrete value equal to 3 and a continuous value equal to 4.5
gum::learning::DBTranslatedValue x1 { std::size_t(3) };
// access these elements and display them
std::cout << x1.discr_val << " " << x2.cont_val << std::endl;

Definition at line 68 of file DBTranslatedValue.h.

Constructor & Destructor Documentation

◆ DBTranslatedValue() [1/3]

constexpr gum::learning::DBTranslatedValue::DBTranslatedValue ( )
inline

default constructor: stores discrete value 0

Definition at line 83 of file DBTranslatedValue.h.

References discr_val.

83 : discr_val{std::size_t(0)} {}
std::size_t discr_val
the field for storing discrete values

◆ DBTranslatedValue() [2/3]

constexpr gum::learning::DBTranslatedValue::DBTranslatedValue ( const float &  val)
inline

the constructor for storing a continuous value

Definition at line 86 of file DBTranslatedValue.h.

References cont_val.

86 : cont_val{val} {}
float cont_val
the field for storing continuous values

◆ DBTranslatedValue() [3/3]

constexpr gum::learning::DBTranslatedValue::DBTranslatedValue ( const std::size_t &  val)
inline

the constructor for storing a discrete value

Definition at line 89 of file DBTranslatedValue.h.

References discr_val.

89 : discr_val{val} {}
std::size_t discr_val
the field for storing discrete values

◆ ~DBTranslatedValue()

gum::learning::DBTranslatedValue::~DBTranslatedValue ( )
inline

destructor

Definition at line 92 of file DBTranslatedValue.h.

92 {};

Member Data Documentation

◆ cont_val

float gum::learning::DBTranslatedValue::cont_val

the field for storing continuous values

Definition at line 73 of file DBTranslatedValue.h.

Referenced by DBTranslatedValue().

◆ discr_val

std::size_t gum::learning::DBTranslatedValue::discr_val

the field for storing discrete values

Definition at line 70 of file DBTranslatedValue.h.

Referenced by DBTranslatedValue().


The documentation for this union was generated from the following file: