40 template <
typename GUM_SCALAR_A,
typename GUM_SCALAR_B >
49 template <
typename GUM_SCALAR_A,
typename GUM_SCALAR_B >
62 template <
typename GUM_SCALAR_A,
typename GUM_SCALAR_B >
64 GUM_SCALAR_B valueB) {
66 if (__attrAMarginalTable.exists(valueA))
67 __attrAMarginalTable[valueA]++;
69 __attrAMarginalTable.insert(valueA, 1);
71 if (__attrBMarginalTable.exists(valueB))
72 __attrBMarginalTable[valueB]++;
74 __attrBMarginalTable.insert(valueB, 1);
76 std::pair< GUM_SCALAR_A, GUM_SCALAR_B > cell(valueA, valueB);
77 if (__jointTable.exists(cell))
80 __jointTable.insert(cell, 1);
83 template <
typename GUM_SCALAR_A,
typename GUM_SCALAR_B >
89 if (__attrAMarginalTable.exists(aTer.key()))
90 __attrAMarginalTable[aTer.key()] += aTer.val();
92 __attrAMarginalTable.insert(aTer.key(), aTer.val());
95 std::pair< GUM_SCALAR_A, GUM_SCALAR_B > cell(aTer.key(), bTer.key());
96 if (__jointTable.exists(cell))
97 __jointTable[cell] += src.
joint(aTer.key(), bTer.key());
99 __jointTable.insert(cell, src.
joint(aTer.key(), bTer.key()));
105 if (__attrBMarginalTable.exists(bTer.key()))
106 __attrBMarginalTable[bTer.key()] += bTer.val();
108 __attrBMarginalTable.insert(bTer.key(), bTer.val());
HashTableConstIteratorSafe< GUM_SCALAR_B, Idx > attrBEndSafe() const
Increments the number of sample for case( iattr, ivalue )
<agrum/FMDP/learning/core/contingencyTable.h>
void add(GUM_SCALAR_A valueA, GUM_SCALAR_B valueB)
Increments the number of sample for case( iattr, ivalue )
Idx joint(GUM_SCALAR_A valueA, GUM_SCALAR_B valueB) const
Returns the number of samples for case (iattr, ivalue)
gum is the global namespace for all aGrUM entities
~ContingencyTable()
Default destructor.
HashTableConstIteratorSafe< GUM_SCALAR_A, Idx > attrAEndSafe() const
Increments the number of sample for case( iattr, ivalue )
HashTableConstIteratorSafe< GUM_SCALAR_A, Idx > attrABeginSafe() const
Returns the number of samples for line iattr.
Headers of the ContingencyTable class.
HashTableConstIteratorSafe< GUM_SCALAR_B, Idx > attrBBeginSafe() const
Returns the number of samples for column ivalue.
ContingencyTable< GUM_SCALAR_A, GUM_SCALAR_B > & operator+=(const ContingencyTable< GUM_SCALAR_A, GUM_SCALAR_B > &src)
ContingencyTable()
Default constructor.