Classes | Public Types | Public Attributes | Protected Member Functions | List of all members
gtsam::DecisionTree< L, Y > Class Template Reference

#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_tLabelC
 
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 Yoperator() (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 ()
 

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

Definition at line 36 of file DecisionTree.h.

Member Typedef Documentation

template<typename L, typename Y>
typedef boost::function<Y(const Y&, const Y&)> gtsam::DecisionTree< L, Y >::Binary

Definition at line 42 of file DecisionTree.h.

template<typename L, typename Y>
typedef std::pair<L,size_t> gtsam::DecisionTree< L, Y >::LabelC

A label annotated with cardinality

Definition at line 45 of file DecisionTree.h.

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

Definition at line 96 of file DecisionTree.h.

template<typename L, typename Y>
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.

Constructor & Destructor Documentation

template<typename L , typename Y >
gtsam::DecisionTree< L, Y >::DecisionTree ( )
protected

Default constructor

Definition at line 372 of file DecisionTree-inl.h.

template<typename L , typename Y>
gtsam::DecisionTree< L, Y >::DecisionTree ( const Y y)

Create a constant

Definition at line 382 of file DecisionTree-inl.h.

template<typename L, typename Y>
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.

template<typename L, typename Y>
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.

template<typename L, typename Y>
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.

template<typename L, typename Y>
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.

template<typename L, typename Y >
template<typename Iterator >
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.

template<typename L, typename Y>
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.

template<typename L, typename Y>
template<typename M , typename X >
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.

template<typename L, typename Y>
virtual gtsam::DecisionTree< L, Y >::~DecisionTree ( )
inlinevirtual

Make virtual

Definition at line 163 of file DecisionTree.h.

template<typename L, typename Y>
gtsam::DecisionTree< L, Y >::DecisionTree ( const NodePtr root)

Definition at line 376 of file DecisionTree-inl.h.

Member Function Documentation

template<typename L , typename Y >
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.

template<typename L , typename Y >
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.

template<typename L, typename Y>
DecisionTree gtsam::DecisionTree< L, Y >::choose ( const L label,
size_t  index 
) const
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.

template<typename L, typename Y >
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.

template<typename L, typename Y>
DecisionTree gtsam::DecisionTree< L, Y >::combine ( const LabelC labelC,
const Binary op 
) const
inline

combine with LabelC for convenience

Definition at line 189 of file DecisionTree.h.

template<typename L, typename Y >
template<typename Iterator >
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.

template<typename L, typename Y>
template<typename M , typename X >
DecisionTree< L, Y >::NodePtr gtsam::DecisionTree< L, Y >::convert ( const typename DecisionTree< M, X >::NodePtr f,
const std::map< M, L > &  map,
boost::function< Y(const X &)>  op 
)
protected

Convert to a different type

Definition at line 569 of file DecisionTree-inl.h.

template<typename L , typename Y >
template<typename It , typename ValueIt >
DecisionTree< L, Y >::NodePtr gtsam::DecisionTree< L, Y >::create ( It  begin,
It  end,
ValueIt  beginY,
ValueIt  endY 
) const
protected

Internal recursive function to create from keys, cardinalities, and Y values

Definition at line 531 of file DecisionTree-inl.h.

template<typename L , typename Y >
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.

template<typename L , typename Y >
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.

template<typename L , typename Y >
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.

template<typename L, typename Y >
const Y & gtsam::DecisionTree< L, Y >::operator() ( const Assignment< L > &  x) const

evaluate

Definition at line 619 of file DecisionTree-inl.h.

template<typename L , typename Y >
bool gtsam::DecisionTree< L, Y >::operator== ( const DecisionTree< L, Y > &  q) const

equality

Definition at line 614 of file DecisionTree-inl.h.

template<typename L , typename Y >
void gtsam::DecisionTree< L, Y >::print ( const std::string &  s = "DecisionTree< LY >") const

GTSAM-style print

Definition at line 609 of file DecisionTree-inl.h.

Member Data Documentation

template<typename L, typename Y>
NodePtr gtsam::DecisionTree< L, Y >::root_

Definition at line 99 of file DecisionTree.h.


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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:58:07