Loading...
Searching...
No Matches
gtsam::DecisionTree< L, Y >::Choice< L, Y > Struct Template Reference
Inheritance diagram for gtsam::DecisionTree< L, Y >::Choice< L, Y >:

## Public Member Functions

| Choice ()
| Default constructor for serialization.
bool | isLeaf () const override
| Choice (const L &label, size_t count)
| Constructor, given choice label and mandatory expected branch count.
| Choice (const Choice &f, const Choice &g, const Binary &op)
| Construct from applying binary op to two Choice nodes.
const L & | label () const
| Return the label of this choice node.
size_t | nrChoices () const
const std::vector< NodePtr > & | branches () const
void | push_back (const NodePtr &node)
| add a branch: TODO merge into constructor
void | print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const override
| print (as a tree).
void | dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero) const override
| output to graphviz (as a a graph)
bool | sameLeaf (const Leaf &q) const override
| Choice-Leaf equality: always false.
bool | sameLeaf (const Node &q) const override
| polymorphic equality: if q is a leaf, could be...
bool | equals (const Node &q, const CompareFunc &compare) const override
| equality
const Y & | operator() (const Assignment< L > &x) const override
| evaluate
| Choice (const L &label, const Choice &f, const Unary &op)
| Construct from applying unary op to a Choice node.
| Choice (const L &label, const Choice &f, const UnaryAssignment &op, const Assignment< L > &assignment)
| Constructor which accepts a UnaryAssignment op and the corresponding assignment.
NodePtr | apply (const Unary &op) const override
| apply unary operator.
NodePtr | apply (const UnaryAssignment &op, const Assignment< L > &assignment) const override
| Apply unary operator with assignment.
NodePtr | apply_f_op_g (const Node &g, const Binary &op) const override
NodePtr | apply_g_op_fL (const Leaf &fL, const Binary &op) const override
NodePtr | apply_g_op_fC (const Choice &fC, const Binary &op) const override
template<typename OP>
NodePtr | apply_fC_op_gL (const Leaf &gL, OP op) const
NodePtr | choose (const L &label, size_t index) const override
| choose a branch, recursively
Public Member Functions inherited from gtsam::DecisionTree< L, Y >::Node
const void * | id () const

## 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.

## Public Attributes

L | label_
| the label of the variable on which we split
std::vector< NodePtr > | branches_
| The children of this Choice node.

## Additional Inherited Members

Public Types inherited from gtsam::DecisionTree< L, Y >::Node
using | Ptr = boost::shared_ptr<const Node>

## Constructor & Destructor Documentation

## Choice()

template<typename L, typename Y>
template<typename L, typename Y>

gtsam::DecisionTree< L, Y >::Choice< L, Y >::Choice | ( | const L & | label,
|  | const Choice< L, Y > & | f,
|  | const UnaryAssignment & | op,
|  | const Assignment< L > & | assignment )

inline

Constructor which accepts a UnaryAssignment op and the corresponding assignment.

Parameters

  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.

## Member Function Documentation

## apply() [1/2]

template<typename L, typename Y>
template<typename L, typename Y>

NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::apply | ( | const Unary & | op | ) | const

inline override virtual

apply unary operator.

Implements gtsam::DecisionTree< L, Y >::Node.

## apply() [2/2]

template<typename L, typename Y>
template<typename L, typename Y>

NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::apply | ( | const UnaryAssignment & | op,
|  | const Assignment< L > & | assignment ) const

inline override virtual

Apply unary operator with assignment.

Implements gtsam::DecisionTree< L, Y >::Node.

## apply_f_op_g()

template<typename L, typename Y>
template<typename L, typename Y>

NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::apply_f_op_g | ( | const Node & | g,
|  | const Binary & | op ) const

inline override virtual

Implements gtsam::DecisionTree< L, Y >::Node.

## apply_g_op_fC()

template<typename L, typename Y>
template<typename L, typename Y>

NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::apply_g_op_fC | ( | const Choice< L, Y > & | fC,
|  | const Binary & | op ) const

inline override virtual

Implements gtsam::DecisionTree< L, Y >::Node.

## apply_g_op_fL()

template<typename L, typename Y>
template<typename L, typename Y>

NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::apply_g_op_fL | ( | const Leaf & | fL,
|  | const Binary & | op ) const

inline override virtual

Implements gtsam::DecisionTree< L, Y >::Node.

## choose()

template<typename L, typename Y>
template<typename L, typename Y>

NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::choose | ( | const L & | label,
|  | size_t | index ) const

inline override virtual

choose a branch, recursively

Implements gtsam::DecisionTree< L, Y >::Node.

## dot()

template<typename L, typename Y>
template<typename L, typename Y>

void gtsam::DecisionTree< L, Y >::Choice< L, Y >::dot | ( | std::ostream & | os,
|  | const LabelFormatter & | labelFormatter,
|  | const ValueFormatter & | valueFormatter,
|  | bool | showZero ) const

inline override virtual

output to graphviz (as a a graph)

Implements gtsam::DecisionTree< L, Y >::Node.

## equals()

template<typename L, typename Y>
template<typename L, typename Y>

bool gtsam::DecisionTree< L, Y >::Choice< L, Y >::equals | ( | const Node & | q,
|  | const CompareFunc & | compare ) const

inline override virtual

equality

Implements gtsam::DecisionTree< L, Y >::Node.

## isLeaf()

template<typename L, typename Y>
template<typename L, typename Y>

bool gtsam::DecisionTree< L, Y >::Choice< L, Y >::isLeaf | ( |  | ) | const

inline override virtual

Implements gtsam::DecisionTree< L, Y >::Node.

## operator()()

template<typename L, typename Y>
template<typename L, typename Y>

const Y & gtsam::DecisionTree< L, Y >::Choice< L, Y >::operator() | ( | const Assignment< L > & | x | ) | const

inline override virtual

evaluate

Implements gtsam::DecisionTree< L, Y >::Node.

## print()

template<typename L, typename Y>
template<typename L, typename Y>

void gtsam::DecisionTree< L, Y >::Choice< L, Y >::print | ( | const std::string & | s,
|  | const LabelFormatter & | labelFormatter,
|  | const ValueFormatter & | valueFormatter ) const

inline override virtual

print (as a tree).

Implements gtsam::DecisionTree< L, Y >::Node.

## sameLeaf() [1/2]

template<typename L, typename Y>
template<typename L, typename Y>

bool gtsam::DecisionTree< L, Y >::Choice< L, Y >::sameLeaf | ( | const Leaf & | q | ) | const

inline override virtual

Choice-Leaf equality: always false.

Implements gtsam::DecisionTree< L, Y >::Node.

## sameLeaf() [2/2]

template<typename L, typename Y>
template<typename L, typename Y>

bool gtsam::DecisionTree< L, Y >::Choice< L, Y >::sameLeaf | ( | const Node & | q | ) | const

inline override virtual

polymorphic equality: if q is a leaf, could be...

Implements gtsam::DecisionTree< L, Y >::Node.

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

- /build/gtsam-gchP9J/gtsam-4.2.2+dfsg/gtsam/discrete/DecisionTree-inl.h