![]() |
aGrUM
0.16.0
|
Class used to store optimum IBayesNet during some inference algorithms. More...
#include <agrum/CN/varMod2BNsMap.h>
Public Member Functions | |
bool | insert (const std::vector< bool > &bn, const std::vector< Size > &key) |
Insert for thread fusion. More... | |
bool | insert (const std::vector< Size > &key, const bool isBetter) |
Thread insert. More... | |
Constructors / Destructors | |
VarMod2BNsMap (const CredalNet< GUM_SCALAR > &cn) | |
Thread constructor. More... | |
VarMod2BNsMap () | |
Default constructor that should be used only by InferenceEngine since it has a member variable. More... | |
~VarMod2BNsMap () | |
Destructor. More... | |
Getters and setters | |
void | setCNet (const CredalNet< GUM_SCALAR > &cn) |
Initialize __sampleDef from the CredalNet. More... | |
void | setCurrentSample (const std::vector< std::vector< std::vector< bool > > > &sample) |
Set the current thread sample and it's hash. More... | |
const dBN & | getCurrentSample () |
Get the current sample as a vector of bits without structure. More... | |
const std::vector< std::vector< std::vector< bool > > > & | getSampleDef () |
Get the sample structure. More... | |
const std::vector< dBN *> | getBNOptsFromKey (const std::vector< Size > &key) |
Get optimum IBayesNet (s) without structure of the given variable, modality for min or max. More... | |
std::vector< std::vector< std::vector< std::vector< bool > > > > | getFullBNOptsFromKey (const std::vector< Size > &key) |
Get optimum IBayesNet (s) with structure of the given variable, modality for min or max. More... | |
Size | getEntrySize () const |
Get the number of IBayesNet stored. More... | |
Protected Attributes | |
hashNet | _myHashNet |
Map id - dBN : get a net from it's id. More... | |
varHashs | _myVarHashs |
Map varKey - list(id) : get all optimal nets id from the given key : variable, modality and min=0 ( or max=1 ). More... | |
hashVars | _myHashVars |
Map id - list(varKey) : get all variables, modalities associated to this optimal net id. More... | |
std::vector< std::vector< std::vector< bool > > > | _sampleDef |
Since all samples have the same structure, this will be used as default initialization (copy constructor) for any sample. More... | |
dBN | _currentSample |
The current sampled IBayesNet. More... | |
Size | _currentHash |
The current sampled IBayesNet hash. More... | |
std::hash< std::vector< bool > > | _vectHash |
The hash fuction. More... | |
const CredalNet< GUM_SCALAR > * | cnet |
A pointer to the CredalNet to be used. More... | |
Class used to store optimum IBayesNet during some inference algorithms.
GUM_SCALAR | A floating type ( float, double, long double ... ). |
Definition at line 56 of file varMod2BNsMap.h.
|
private |
Definition at line 58 of file varMod2BNsMap.h.
|
private |
Definition at line 62 of file varMod2BNsMap.h.
|
private |
Definition at line 66 of file varMod2BNsMap.h.
|
private |
Definition at line 64 of file varMod2BNsMap.h.
|
private |
Definition at line 60 of file varMod2BNsMap.h.
|
explicit |
Thread constructor.
Initialize __sampleDef from the CredalNet.
cn | The CredalNet to be used. |
Definition at line 36 of file varMod2BNsMap_tpl.h.
gum::credal::VarMod2BNsMap< GUM_SCALAR >::VarMod2BNsMap | ( | ) |
Default constructor that should be used only by InferenceEngine since it has a member variable.
Definition at line 29 of file varMod2BNsMap_tpl.h.
gum::credal::VarMod2BNsMap< GUM_SCALAR >::~VarMod2BNsMap | ( | ) |
Destructor.
Definition at line 43 of file varMod2BNsMap_tpl.h.
const std::vector< std::vector< bool > *> gum::credal::VarMod2BNsMap< GUM_SCALAR >::getBNOptsFromKey | ( | const std::vector< Size > & | key | ) |
Get optimum IBayesNet (s) without structure of the given variable, modality for min or max.
key | The constant reference to the variable, modality, min or max. |
Definition at line 198 of file varMod2BNsMap_tpl.h.
const std::vector< bool > & gum::credal::VarMod2BNsMap< GUM_SCALAR >::getCurrentSample | ( | ) |
Get the current sample as a vector of bits without structure.
Definition at line 186 of file varMod2BNsMap_tpl.h.
Size gum::credal::VarMod2BNsMap< GUM_SCALAR >::getEntrySize | ( | ) | const |
Get the number of IBayesNet stored.
Definition at line 254 of file varMod2BNsMap_tpl.h.
std::vector< std::vector< std::vector< std::vector< bool > > > > gum::credal::VarMod2BNsMap< GUM_SCALAR >::getFullBNOptsFromKey | ( | const std::vector< Size > & | key | ) |
Get optimum IBayesNet (s) with structure of the given variable, modality for min or max.
key | The constant reference to the variable, modality, min or max. |
Definition at line 219 of file varMod2BNsMap_tpl.h.
References GUM_ERROR.
const std::vector< std::vector< std::vector< bool > > > & gum::credal::VarMod2BNsMap< GUM_SCALAR >::getSampleDef | ( | ) |
Get the sample structure.
Definition at line 192 of file varMod2BNsMap_tpl.h.
bool gum::credal::VarMod2BNsMap< GUM_SCALAR >::insert | ( | const std::vector< bool > & | bn, |
const std::vector< Size > & | key | ||
) |
Insert for thread fusion.
All inserted nets are optimums and none will be deleted because a better one is being inserted.
bn | The constant reference to the net to be inserted. |
key | The constant reference to the key at which we will insert the net. |
Definition at line 70 of file varMod2BNsMap_tpl.h.
bool gum::credal::VarMod2BNsMap< GUM_SCALAR >::insert | ( | const std::vector< Size > & | key, |
const bool | isBetter | ||
) |
Thread insert.
key | The key at which the net will be inserted. |
isBetter | True if the net is a better one, i.e. it gave better marginals. |
True
if the net was inserted, false
otherwise. Definition at line 92 of file varMod2BNsMap_tpl.h.
void gum::credal::VarMod2BNsMap< GUM_SCALAR >::setCNet | ( | const CredalNet< GUM_SCALAR > & | cn | ) |
Initialize __sampleDef from the CredalNet.
Shoud only be used by InferenceEngine to initialize it's member variable.
cn | The CredalNet to be used. |
Definition at line 48 of file varMod2BNsMap_tpl.h.
References gum::credal::CredalNet< GUM_SCALAR >::credalNet_currentCpt(), and gum::superiorPow().
void gum::credal::VarMod2BNsMap< GUM_SCALAR >::setCurrentSample | ( | const std::vector< std::vector< std::vector< bool > > > & | sample | ) |
Set the current thread sample and it's hash.
sample | The constant reference to the sample with structure. |
Definition at line 170 of file varMod2BNsMap_tpl.h.
|
protected |
The current sampled IBayesNet hash.
Definition at line 87 of file varMod2BNsMap.h.
|
protected |
The current sampled IBayesNet.
Definition at line 85 of file varMod2BNsMap.h.
|
protected |
Map id - dBN : get a net from it's id.
Definition at line 70 of file varMod2BNsMap.h.
|
protected |
Map id - list(varKey) : get all variables, modalities associated to this optimal net id.
Definition at line 77 of file varMod2BNsMap.h.
|
protected |
Map varKey - list(id) : get all optimal nets id from the given key : variable, modality and min=0 ( or max=1 ).
Definition at line 73 of file varMod2BNsMap.h.
|
protected |
Since all samples have the same structure, this will be used as default initialization (copy constructor) for any sample.
Definition at line 82 of file varMod2BNsMap.h.
|
protected |
|
protected |
A pointer to the CredalNet to be used.
Definition at line 92 of file varMod2BNsMap.h.