#include <DecisionTree.h>
Classes | |
class | Choice |
class | Leaf |
class | Node |
Public Types | |
typedef boost::function< Y(const Y &, const Y &)> | Binary |
typedef std::pair< L, size_t > | LabelC |
typedef Node::Ptr | NodePtr |
typedef boost::function< Y(const Y &)> | Unary |
Public Member Functions | |
Standard Constructors | |
DecisionTree (const Y &y) | |
DecisionTree (const L &label, const Y &y1, const Y &y2) | |
DecisionTree (const LabelC &label, const Y &y1, const Y &y2) | |
DecisionTree (const std::vector< LabelC > &labelCs, const std::vector< Y > &ys) | |
DecisionTree (const std::vector< LabelC > &labelCs, const std::string &table) | |
template<typename Iterator > | |
DecisionTree (Iterator begin, Iterator end, const L &label) | |
DecisionTree (const L &label, const DecisionTree &f0, const DecisionTree &f1) | |
template<typename M , typename X > | |
DecisionTree (const DecisionTree< M, X > &other, const std::map< M, L > &map, boost::function< Y(const X &)> op) | |
Testable | |
void | print (const std::string &s="DecisionTree") const |
bool | equals (const DecisionTree &other, double tol=1e-9) const |
Standard Interface | |
virtual | ~DecisionTree () |
bool | operator== (const DecisionTree &q) const |
const Y & | operator() (const Assignment< L > &x) const |
DecisionTree | apply (const Unary &op) const |
DecisionTree | apply (const DecisionTree &g, const Binary &op) const |
DecisionTree | choose (const L &label, size_t index) const |
DecisionTree | combine (const L &label, size_t cardinality, const Binary &op) const |
DecisionTree | combine (const LabelC &labelC, const Binary &op) const |
void | dot (std::ostream &os, bool showZero=true) const |
void | dot (const std::string &name, bool showZero=true) const |
Advanced Interface | |
DecisionTree (const NodePtr &root) | |
template<typename Iterator > | |
NodePtr | compose (Iterator begin, Iterator end, const L &label) const |
Public Attributes | |
NodePtr | root_ |
Protected Member Functions | |
template<typename M , typename X > | |
NodePtr | convert (const typename DecisionTree< M, X >::NodePtr &f, const std::map< M, L > &map, boost::function< Y(const X &)> op) |
template<typename It , typename ValueIt > | |
NodePtr | create (It begin, It end, ValueIt beginY, ValueIt endY) const |
DecisionTree () | |
Decision Tree L = label for variables Y = function range (any algebra), e.g., bool, int, double
Definition at line 36 of file DecisionTree.h.
typedef boost::function<Y(const Y&, const Y&)> gtsam::DecisionTree< L, Y >::Binary |
Definition at line 42 of file DecisionTree.h.
A label annotated with cardinality
Definition at line 45 of file DecisionTree.h.
typedef Node::Ptr gtsam::DecisionTree< L, Y >::NodePtr |
------------------—— Node base class ---------------------—— A function is a shared pointer to the root of a DT
Definition at line 96 of file DecisionTree.h.
typedef boost::function<Y(const Y&)> gtsam::DecisionTree< L, Y >::Unary |
Handy typedefs for unary and binary function types
Definition at line 41 of file DecisionTree.h.
|
protected |
Default constructor
Definition at line 372 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const Y & | y | ) |
Create a constant
Definition at line 382 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const L & | label, |
const Y & | y1, | ||
const Y & | y2 | ||
) |
Create a new leaf function splitting on a variable
Definition at line 388 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const LabelC & | label, |
const Y & | y1, | ||
const Y & | y2 | ||
) |
Allow Label+Cardinality for convenience
Definition at line 399 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const std::vector< LabelC > & | labelCs, |
const std::vector< Y > & | ys | ||
) |
Create from keys and a corresponding vector of values
Definition at line 412 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const std::vector< LabelC > & | labelCs, |
const std::string & | table | ||
) |
Create from keys and string table
Definition at line 420 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | Iterator | begin, |
Iterator | end, | ||
const L & | label | ||
) |
Create DecisionTree from others
Definition at line 435 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const L & | label, |
const DecisionTree< L, Y > & | f0, | ||
const DecisionTree< L, Y > & | f1 | ||
) |
Create DecisionTree from two others
Definition at line 442 of file DecisionTree-inl.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const DecisionTree< M, X > & | other, |
const std::map< M, L > & | map, | ||
boost::function< Y(const X &)> | op | ||
) |
Convert from a different type
Definition at line 452 of file DecisionTree-inl.h.
|
inlinevirtual |
Make virtual
Definition at line 163 of file DecisionTree.h.
gtsam::DecisionTree< L, Y >::DecisionTree | ( | const NodePtr & | root | ) |
Definition at line 376 of file DecisionTree-inl.h.
DecisionTree< L, Y > gtsam::DecisionTree< L, Y >::apply | ( | const Unary & | op | ) | const |
apply Unary operation "op" to f
Definition at line 624 of file DecisionTree-inl.h.
DecisionTree< L, Y > gtsam::DecisionTree< L, Y >::apply | ( | const DecisionTree< L, Y > & | g, |
const Binary & | op | ||
) | const |
apply binary operation "op" to f and g
Definition at line 630 of file DecisionTree-inl.h.
|
inline |
create a new function where value(label)==index It's like "restrict" in Darwiche09book pg329, 330?
Definition at line 180 of file DecisionTree.h.
DecisionTree< L, Y > gtsam::DecisionTree< L, Y >::combine | ( | const L & | label, |
size_t | cardinality, | ||
const Binary & | op | ||
) | const |
combine subtrees on key with binary operation "op"
Definition at line 649 of file DecisionTree-inl.h.
|
inline |
combine with LabelC for convenience
Definition at line 189 of file DecisionTree.h.
DecisionTree< L, Y >::NodePtr gtsam::DecisionTree< L, Y >::compose | ( | Iterator | begin, |
Iterator | end, | ||
const L & | label | ||
) | const |
Definition at line 464 of file DecisionTree-inl.h.
|
protected |
Convert to a different type
Definition at line 569 of file DecisionTree-inl.h.
|
protected |
Internal recursive function to create from keys, cardinalities, and Y values
Definition at line 531 of file DecisionTree-inl.h.
void gtsam::DecisionTree< L, Y >::dot | ( | std::ostream & | os, |
bool | showZero = true |
||
) | const |
output to graphviz format, stream version
Definition at line 661 of file DecisionTree-inl.h.
void gtsam::DecisionTree< L, Y >::dot | ( | const std::string & | name, |
bool | showZero = true |
||
) | const |
output to graphviz format, open a file
Definition at line 668 of file DecisionTree-inl.h.
bool gtsam::DecisionTree< L, Y >::equals | ( | const DecisionTree< L, Y > & | other, |
double | tol = 1e-9 |
||
) | const |
Definition at line 604 of file DecisionTree-inl.h.
const Y & gtsam::DecisionTree< L, Y >::operator() | ( | const Assignment< L > & | x | ) | const |
evaluate
Definition at line 619 of file DecisionTree-inl.h.
bool gtsam::DecisionTree< L, Y >::operator== | ( | const DecisionTree< L, Y > & | q | ) | const |
equality
Definition at line 614 of file DecisionTree-inl.h.
void gtsam::DecisionTree< L, Y >::print | ( | const std::string & | s = "DecisionTree< L, Y >" | ) | const |
GTSAM-style print
Definition at line 609 of file DecisionTree-inl.h.
NodePtr gtsam::DecisionTree< L, Y >::root_ |
Definition at line 99 of file DecisionTree.h.