#include <DecisionTree-inl.h>
Public Member Functions | |
NodePtr | apply (const Unary &op) const override |
apply unary operator. More... | |
NodePtr | apply (const UnaryAssignment &op, const Assignment< L > &assignment) const override |
Apply unary operator with assignment. More... | |
NodePtr | apply_f_op_g (const Node &g, const Binary &op) const override |
template<typename OP > | |
NodePtr | apply_fC_op_gL (const Leaf &gL, OP op) const |
NodePtr | apply_g_op_fC (const Choice &fC, const Binary &op) const override |
NodePtr | apply_g_op_fL (const Leaf &fL, const Binary &op) const override |
const std::vector< NodePtr > & | branches () const |
Choice () | |
Default constructor for serialization. More... | |
Choice (const L &label, size_t count) | |
Constructor, given choice label and mandatory expected branch count. More... | |
Choice (const Choice &f, const Choice &g, const Binary &op) | |
Construct from applying binary op to two Choice nodes. More... | |
Choice (const L &label, const Choice &f, const Unary &op) | |
Construct from applying unary op to a Choice node. More... | |
Choice (const L &label, const Choice &f, const UnaryAssignment &op, const Assignment< L > &assignment) | |
Constructor which accepts a UnaryAssignment op and the corresponding assignment. More... | |
NodePtr | choose (const L &label, size_t index) const override |
void | dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero) const override |
bool | equals (const Node &q, const CompareFunc &compare) const override |
equality More... | |
bool | isLeaf () const override |
const L & | label () const |
Return the label of this choice node. More... | |
size_t | nrChoices () const |
const Y & | operator() (const Assignment< L > &x) const override |
evaluate More... | |
void | print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const override |
print (as a tree). More... | |
void | push_back (const NodePtr &node) |
bool | sameLeaf (const Leaf &q) const override |
Choice-Leaf equality: always false. More... | |
bool | sameLeaf (const Node &q) const override |
polymorphic equality: if q is a leaf, could be... More... | |
~Choice () override | |
Public Member Functions inherited from gtsam::DecisionTree< L, Y >::Node | |
const void * | id () const |
Node () | |
virtual | ~Node () |
Static Public Member Functions | |
static NodePtr | Unique (const ChoicePtr &f) |
If all branches of a choice node f are the same, just return a branch. More... | |
Public Attributes | |
std::vector< NodePtr > | branches_ |
L | label_ |
Private Types | |
using | Base = DecisionTree< L, Y >::Node |
using | ChoicePtr = std::shared_ptr< const Choice > |
Private Attributes | |
size_t | allSame_ |
Additional Inherited Members | |
Public Types inherited from gtsam::DecisionTree< L, Y >::Node | |
using | Ptr = std::shared_ptr< const Node > |
Definition at line 174 of file DecisionTree-inl.h.
|
private |
Definition at line 447 of file DecisionTree-inl.h.
|
private |
Definition at line 188 of file DecisionTree-inl.h.
|
inline |
Default constructor for serialization.
Definition at line 192 of file DecisionTree-inl.h.
|
inlineoverride |
Definition at line 194 of file DecisionTree-inl.h.
|
inline |
Constructor, given choice label and mandatory expected branch count.
Definition at line 226 of file DecisionTree-inl.h.
|
inline |
Construct from applying binary op to two Choice nodes.
Definition at line 232 of file DecisionTree-inl.h.
|
inline |
Construct from applying unary op to a Choice node.
Definition at line 353 of file DecisionTree-inl.h.
|
inline |
Constructor which accepts a UnaryAssignment op and the corresponding assignment.
label | The label for this node. |
f | The original choice node to apply the op on. |
op | Function to apply on the choice node. Takes Assignment and value as arguments. |
assignment | The Assignment that will go to op. |
Definition at line 371 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
apply unary operator.
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 391 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
Apply unary operator with assignment.
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 397 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 408 of file DecisionTree-inl.h.
|
inline |
Definition at line 428 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 421 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 413 of file DecisionTree-inl.h.
|
inline |
Definition at line 268 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
choose a branch, recursively
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 436 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
output to graphviz (as a a graph)
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 292 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
equality
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 325 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 223 of file DecisionTree-inl.h.
|
inline |
Return the label of this choice node.
Definition at line 260 of file DecisionTree-inl.h.
|
inline |
Definition at line 264 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
evaluate
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 338 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
print (as a tree).
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 282 of file DecisionTree-inl.h.
|
inline |
add a branch: TODO merge into constructor
Definition at line 273 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
Choice-Leaf equality: always false.
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 315 of file DecisionTree-inl.h.
|
inlineoverridevirtual |
polymorphic equality: if q is a leaf, could be...
Implements gtsam::DecisionTree< L, Y >::Node.
Definition at line 320 of file DecisionTree-inl.h.
|
inlinestatic |
If all branches of a choice node f are the same, just return a branch.
Definition at line 202 of file DecisionTree-inl.h.
|
private |
Incremental allSame. Records if all the branches are the same leaf.
Definition at line 186 of file DecisionTree-inl.h.
std::vector<NodePtr> gtsam::DecisionTree< L, Y >::Choice< L, Y >::branches_ |
The children of this Choice node.
Definition at line 179 of file DecisionTree-inl.h.
L gtsam::DecisionTree< L, Y >::Choice< L, Y >::label_ |
the label of the variable on which we split
Definition at line 176 of file DecisionTree-inl.h.