gtsam 4.1.1
gtsam::DecisionTree< L, Y > Class Template Reference

Detailed Description

template<typename L, typename Y>
class gtsam::DecisionTree< L, Y >

Decision Tree L = label for variables Y = function range (any algebra), e.g., bool, int, double.

Public Member Functions

Standard Constructors
 DecisionTree (const Y &y)
 Create a constant.
 DecisionTree (const L &label, const Y &y1, const Y &y2)
 Create a new leaf function splitting on a variable.
 DecisionTree (const LabelC &label, const Y &y1, const Y &y2)
 Allow Label+Cardinality for convenience.
 DecisionTree (const std::vector< LabelC > &labelCs, const std::vector< Y > &ys)
 Create from keys and a corresponding vector of values.
 DecisionTree (const std::vector< LabelC > &labelCs, const std::string &table)
 Create from keys and string table.
template<typename Iterator >
 DecisionTree (Iterator begin, Iterator end, const L &label)
 Create DecisionTree from others.
 DecisionTree (const L &label, const DecisionTree &f0, const DecisionTree &f1)
 Create DecisionTree from two others.
template<typename M , typename X >
 DecisionTree (const DecisionTree< M, X > &other, const std::map< M, L > &map, std::function< Y(const X &)> op)
 Convert from a different type.
void print (const std::string &s="DecisionTree") const
 GTSAM-style print.
bool equals (const DecisionTree &other, double tol=1e-9) const
Standard Interface
virtual ~DecisionTree ()
 Make virtual.
bool operator== (const DecisionTree &q) const
const Y & operator() (const Assignment< L > &x) const
DecisionTree apply (const Unary &op) const
 apply Unary operation "op" to f
DecisionTree apply (const DecisionTree &g, const Binary &op) const
 apply binary operation "op" to f and g
DecisionTree choose (const L &label, size_t index) const
 create a new function where value(label)==index It's like "restrict" in Darwiche09book pg329, 330?
DecisionTree combine (const L &label, size_t cardinality, const Binary &op) const
 combine subtrees on key with binary operation "op"
DecisionTree combine (const LabelC &labelC, const Binary &op) const
 combine with LabelC for convenience
void dot (std::ostream &os, bool showZero=true) const
 output to graphviz format, stream version
void dot (const std::string &name, bool showZero=true) const
 output to graphviz format, open a file
Advanced Interface
 DecisionTree (const NodePtr &root)
template<typename Iterator >
NodePtr compose (Iterator begin, Iterator end, const L &label) const

Public Attributes

NodePtr root_

Public Types

typedef std::function< Y(const Y &)> Unary
 Handy typedefs for unary and binary function types.
typedef std::function< Y(const Y &, const Y &)> Binary
typedef std::pair< L, size_t > LabelC
 A label annotated with cardinality.
typedef Node::Ptr NodePtr
 ---------------------— Node base class ------------------------— More...


class  Choice
class  Leaf
class  Node
 ---------------------— Node base class ------------------------— More...

Protected Member Functions

template<typename It , typename ValueIt >
NodePtr create (It begin, It end, ValueIt beginY, ValueIt endY) const
 Internal recursive function to create from keys, cardinalities, and Y values.
template<typename M , typename X >
NodePtr convert (const typename DecisionTree< M, X >::NodePtr &f, const std::map< M, L > &map, std::function< Y(const X &)> op)
 Convert to a different type.
 DecisionTree ()
 Default constructor.

Member Typedef Documentation

◆ NodePtr

template<typename L , typename Y >
typedef Node::Ptr gtsam::DecisionTree< L, Y >::NodePtr

---------------------— Node base class ------------------------—

A function is a shared pointer to the root of a DT

The documentation for this class was generated from the following files: