Public Types | Public Member Functions | List of all members
DT Struct Reference
Inheritance diagram for DT:
Inheritance graph
[legend]

Public Types

using Base = DecisionTree< string, int >
 
- Public Types inherited from gtsam::DecisionTree< string, int >
using Binary = std::function< int(const int &, const int &)>
 
using CompareFunc = std::function< bool(const int &, const int &)>
 
using LabelC = std::pair< string, size_t >
 
using LabelFormatter = std::function< std::string(string)>
 
using NodePtr = typename Node::Ptr
 
using Unary = std::function< int(const int &)>
 
using UnaryAssignment = std::function< int(const Assignment< string > &, const int &)>
 
using ValueFormatter = std::function< std::string(int)>
 

Public Member Functions

 DT ()=default
 
 DT (const Base &dt)
 
bool equals (const Base &other, double tol=1e-9) const
 Equality method customized to int node type. More...
 
void print (const std::string &s="") const
 print to stdout More...
 
- Public Member Functions inherited from gtsam::DecisionTree< string, int >
 DecisionTree ()
 
 DecisionTree (const int &y)
 
 DecisionTree (const string &label, const int &y1, const int &y2)
 Create tree with 2 assignments y1, y2, splitting on variable label More...
 
 DecisionTree (const LabelC &label, const int &y1, const int &y2)
 
 DecisionTree (const std::vector< LabelC > &labelCs, const std::vector< int > &ys)
 
 DecisionTree (const std::vector< LabelC > &labelCs, const std::string &table)
 
 DecisionTree (Iterator begin, Iterator end, const string &label)
 
 DecisionTree (const string &label, const DecisionTree &f0, const DecisionTree &f1)
 
 DecisionTree (const Unary &op, DecisionTree &&other) noexcept
 Move constructor for DecisionTree. Very efficient as does not allocate anything, just changes in-place. But other is consumed. More...
 
 DecisionTree (const DecisionTree< string, X > &other, Func Y_of_X)
 Convert from a different value type. More...
 
 DecisionTree (const DecisionTree< M, X > &other, const std::map< M, string > &map, Func Y_of_X)
 Convert from a different value type X to value type Y, also translate labels via map from type M to L. More...
 
void print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const
 GTSAM-style print. More...
 
bool equals (const DecisionTree &other, const CompareFunc &compare=&DefaultCompare) const
 
virtual ~DecisionTree ()=default
 Make virtual. More...
 
bool empty () const
 Check if tree is empty. More...
 
bool operator== (const DecisionTree &q) const
 
const intoperator() (const Assignment< string > &x) const
 
void visit (Func f) const
 Visit all leaves in depth-first fashion. More...
 
void visitLeaf (Func f) const
 Visit all leaves in depth-first fashion. More...
 
void visitWith (Func f) const
 Visit all leaves in depth-first fashion. More...
 
size_t nrLeaves () const
 Return the number of leaves in the tree. More...
 
X fold (Func f, X x0) const
 Fold a binary function over the tree, returning accumulator. More...
 
std::set< string > labels () const
 
DecisionTree apply (const Unary &op) const
 
DecisionTree apply (const UnaryAssignment &op) const
 Apply Unary operation "op" to f while also providing the corresponding assignment. More...
 
DecisionTree apply (const DecisionTree &g, const Binary &op) const
 
DecisionTree choose (const string &label, size_t index) const
 
DecisionTree combine (const string &label, size_t cardinality, const Binary &op) const
 
DecisionTree combine (const LabelC &labelC, const Binary &op) const
 
void dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const
 
void dot (const std::string &name, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const
 
std::string dot (const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero=true) const
 
std::pair< DecisionTree< string, A >, DecisionTree< string, B > > split (std::function< std::pair< A, B >(const int &)> AB_of_Y) const
 Convert into two trees with value types A and B. More...
 
 DecisionTree (const NodePtr &root)
 

Additional Inherited Members

- Static Public Member Functions inherited from gtsam::DecisionTree< string, int >
static NodePtr compose (Iterator begin, Iterator end, const string &label)
 
- Public Attributes inherited from gtsam::DecisionTree< string, int >
NodePtr root_
 A DecisionTree just contains the root. TODO(dellaert): make protected. More...
 
- Static Protected Member Functions inherited from gtsam::DecisionTree< string, int >
static NodePtr build (It begin, It end, ValueIt beginY, ValueIt endY)
 
static NodePtr convertFrom (const typename DecisionTree< M, X >::NodePtr &f, std::function< string(const M &)> L_of_M, std::function< int(const X &)> Y_of_X)
 Convert from a DecisionTree<M, X> to DecisionTree<L, Y>. More...
 
static NodePtr convertFrom (const typename DecisionTree< string, X >::NodePtr &f, std::function< int(const X &)> Y_of_X)
 Convert from a DecisionTree<L, X> to DecisionTree<L, Y>. More...
 
static NodePtr create (It begin, It end, ValueIt beginY, ValueIt endY)
 
static bool DefaultCompare (const int &a, const int &b)
 Default method for comparison of two objects of type Y. More...
 

Detailed Description

Definition at line 95 of file testDecisionTree.cpp.

Member Typedef Documentation

◆ Base

using DT::Base = DecisionTree<string, int>

Definition at line 96 of file testDecisionTree.cpp.

Constructor & Destructor Documentation

◆ DT() [1/2]

DT::DT ( )
default

◆ DT() [2/2]

DT::DT ( const Base dt)
inline

Definition at line 100 of file testDecisionTree.cpp.

Member Function Documentation

◆ equals()

bool DT::equals ( const Base other,
double  tol = 1e-9 
) const
inline

Equality method customized to int node type.

Definition at line 113 of file testDecisionTree.cpp.

◆ print()

void DT::print ( const std::string &  s = "") const
inline

print to stdout

Definition at line 103 of file testDecisionTree.cpp.


The documentation for this struct was generated from the following file:


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:10:01