66 for (
const auto& frontalVals : allPosbValues) {
67 double pValueS = pFS(frontalVals);
77 (*values)[
j] = mpe[
j];
94 double pValueS = pFS(frontals);
108 for (
auto&& conditional : bayesNet) {
109 if (
auto lookupTable =
110 std::dynamic_pointer_cast<DiscreteLookupTable>(conditional)) {
113 throw std::runtime_error(
114 "DiscreteFactorGraph::maxProduct: Expected look up table.");
124 (*it)->argmaxInPlace(&result);
void print(const std::string &s="", const typename Base::LabelFormatter &labelFormatter=&DefaultFormatter) const
print method customized to value type double.
shared_ptr choose(const DiscreteValues &given) const
< DiscreteValues version
DecisionTreeFactor ::const_iterator endFrontals() const
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
DecisionTreeFactor ::const_iterator beginParents() const
size_t nrFrontals() const
Frontals frontals() const
std::reverse_iterator< Iterator > make_reverse_iterator(Iterator i)
void print(const std::string &s="Discrete Lookup Table: ", const KeyFormatter &formatter=DefaultKeyFormatter) const override
GTSAM-style print.
const KeyFormatter & formatter
DecisionTreeFactor ::const_iterator beginFrontals() const
const_iterator end() const
size_t cardinality(Key j) const
DecisionTreeFactor ::const_iterator endParents() const
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
void argmaxInPlace(DiscreteValues *parentsValues) const
Calculate assignment for frontal variables that maximizes value.
size_t argmax() const
Return assignment that maximizes distribution.
static DiscreteLookupDAG FromBayesNet(const DiscreteBayesNet &bayesNet)
Create from BayesNet with LookupTables.
Key firstFrontalKey() const
KeyVector::const_iterator const_iterator
Const iterator over keys.
const_iterator begin() const
DiscreteValues argmax(DiscreteValues given=DiscreteValues()) const
argmax by back-substitution, optionally given certain variables.
std::uint64_t Key
Integer nonlinear key type.
std::vector< DiscreteValues > frontalAssignments() const
Return all assignments for frontal variables.