Go to the documentation of this file.
32 using namespace gtsam;
44 auto prior = std::make_shared<DiscreteConditional>(Parent %
"6/4");
49 std::make_shared<DiscreteConditional>(Child | Parent =
"7/3 8/2");
59 const double expectedMarginal[2]{0.4, 0.6 * 0.3 + 0.4 * 0.2};
61 for (
size_t j = 0;
j < 2;
j++) {
90 Vector2 va(0.99, 0.01), vs(0.5, 0.5);
118 SETDEBUG(
"DiscreteConditional::sample",
false);
119 auto actualSample = chordal2->sample();
130 bn.
add((
E |
T,
L) =
"OR");
131 bn.
add((
E |
T,
L) =
"AND");
135 bn.
add(
C |
S =
"1/1/2 5/2/3");
148 string actual = fragment.
dot();
153 " var0[label=\"0\"];\n"
154 " var3[label=\"3\"];\n"
155 " var4[label=\"4\"];\n"
156 " var5[label=\"5\"];\n"
157 " var6[label=\"6\"];\n"
174 "`DiscreteBayesNet` of size 2\n"
182 " *P(Smoking|Asia):*\n\n"
AlgebraicDecisionTree< Key > ADT
static int runAllTests(TestResult &result)
static const DiscreteKey LungCancer(6, 2)
std::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType={}, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
string markdown(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of markdown.
static const DiscreteKey Tuberculosis(3, 2)
typedef and functions to augment Eigen's VectorXd
static const DiscreteKey XRay(2, 2)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define EXPECT_LONGS_EQUAL(expected, actual)
Concept check for values that can be used in unit tests.
#define EXPECT(condition)
void dot(std::ostream &os, const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DotWriter &writer=DotWriter()) const
Output to graphviz format, stream version.
const KeyFormatter & formatter
Eigen::Triplet< double > T
const EIGEN_DEVICE_FUNC LogReturnType log() const
Key back() const
Last key.
static const DiscreteKey Bronchitis(7, 2)
const HybridBayesNet bayesNet
double logProbability(const DiscreteValues &values) const
static const DiscreteKey Smoking(4, 2)
std::string markdown(const KeyFormatter &keyFormatter=DefaultKeyFormatter, const DiscreteFactor::Names &names={}) const
Render as markdown tables.
double evaluate(const DiscreteValues &values) const
static const DiscreteKey Dyspnea(1, 2)
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
A class for computing marginals in a DiscreteFactorGraph.
static enum @1096 ordering
TEST(DiscreteBayesNet, bayesNet)
const gtsam::Symbol key('X', 0)
sharedFactor back() const
static const DiscreteKey Either(5, 2)
void push_back(std::shared_ptr< HybridConditional > conditional)
Add a hybrid conditional using a shared_ptr.
void add(const DiscreteKey &key, const std::string &spec)
Matrix< Scalar, Dynamic, Dynamic > C
std::pair< Key, size_t > DiscreteKey
void add(Args &&... args)
std::shared_ptr< This > shared_ptr
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
DiscreteValues optimize(OptionalOrderingType orderingType={}) const
Find the maximum probable explanation (MPE) by doing max-product.
Marginals marginals(graph, result)
std::uint64_t Key
Integer nonlinear key type.
#define LONGS_EQUAL(expected, actual)
static const DiscreteKey Asia(0, 2)
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:21