24 #include <boost/shared_ptr.hpp> 25 #include <boost/make_shared.hpp> 34 public Conditional<DecisionTreeFactor, DiscreteConditional> {
46 typedef boost::shared_ptr<Values> sharedValues;
63 const DecisionTreeFactor& marginal,
const boost::optional<Ordering>& orderedKeys = boost::none);
72 template<
typename ITERATOR>
73 static shared_ptr Combine(ITERATOR firstConditional,
74 ITERATOR lastConditional);
81 void print(
const std::string& s =
"Discrete Conditional: ",
82 const KeyFormatter& formatter = DefaultKeyFormatter)
const;
97 DecisionTreeFactor::shared_ptr
toFactor()
const {
109 size_t solve(
const Values& parentsValues)
const;
116 size_t sample(
const Values& parentsValues)
const;
123 void solveInPlace(
Values& parentsValues)
const;
126 void sampleInPlace(
Values& parentsValues)
const;
137 template<
typename ITERATOR>
139 ITERATOR firstConditional, ITERATOR lastConditional) {
145 for (ITERATOR it = firstConditional; it != lastConditional;
148 DecisionTreeFactor::shared_ptr factor = c->toFactor();
149 product = (*factor) * product;
152 return boost::make_shared<DiscreteConditional>(
nrFrontals, product);
const double & operator()(const Assignment< Key > &x) const
evaluate
Definition: DecisionTree-inl.h:619
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
DecisionTreeFactor::shared_ptr toFactor() const
Convert to a factor.
Definition: DiscreteConditional.h:97
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
static shared_ptr Combine(ITERATOR firstConditional, ITERATOR lastConditional)
Combine several conditional into a single one.
Definition: DiscreteConditional.h:138
Discrete Conditional Density Derives from DecisionTreeFactor.
Definition: DiscreteConditional.h:33
Template to create a binary predicate.
Definition: Testable.h:110
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: DiscreteFactor.h:34
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
DiscreteConditional()
default constructor needed for serialization
Definition: DiscreteConditional.h:52
Assignment< Key > Values
A map from keys to values.
Definition: DiscreteConditional.h:45
signatures for conditional densities
An assignment from labels to value index (size_t).
Definition: Assignment.h:34
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
TODO: Update comments.
Definition: Conditional.h:40
DecisionTreeFactor BaseFactor
Typedef to our factor base class.
Definition: DiscreteConditional.h:40
A discrete probabilistic factor.
Definition: DecisionTreeFactor.h:38
Signature for a discrete conditional density, used to construct conditionals.
Definition: Signature.h:52
Conditional< BaseFactor, This > BaseConditional
Typedef to our conditional base class.
Definition: DiscreteConditional.h:41
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
size_t nrFrontals() const
return the number of frontals
Definition: Conditional.h:84
DiscreteConditional This
Typedef to this class.
Definition: DiscreteConditional.h:38
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: DiscreteConditional.h:39
virtual double operator()(const Values &values) const
Evaluate, just look up in AlgebraicDecisonTree.
Definition: DiscreteConditional.h:92
Base class for conditional densities.