Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Attributes | List of all members
gtsam::DecisionTree< L, Y >::Choice< L, Y > Struct Template Reference

#include <DecisionTree-inl.h>

Inheritance diagram for gtsam::DecisionTree< L, Y >::Choice< L, Y >:
Inheritance graph
[legend]

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 Llabel () const
 Return the label of this choice node. More...
 
size_t nrChoices () const
 
const Yoperator() (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< NodePtrbranches_
 
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 >
 

Detailed Description

template<typename L, typename Y>
template<typename L, typename Y>
struct gtsam::DecisionTree< L, Y >::Choice< L, Y >

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

Member Typedef Documentation

◆ Base

template<typename L, typename Y>
template<typename L , typename Y >
using gtsam::DecisionTree< L, Y >::Choice< L, Y >::Base = DecisionTree<L, Y>::Node
private

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

◆ ChoicePtr

template<typename L, typename Y>
template<typename L , typename Y >
using gtsam::DecisionTree< L, Y >::Choice< L, Y >::ChoicePtr = std::shared_ptr<const Choice>
private

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

Constructor & Destructor Documentation

◆ Choice() [1/5]

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

Default constructor for serialization.

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

◆ ~Choice()

template<typename L, typename Y>
template<typename L , typename Y >
gtsam::DecisionTree< L, Y >::Choice< L, Y >::~Choice ( )
inlineoverride

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

◆ Choice() [2/5]

template<typename L, typename Y>
template<typename L , typename Y >
gtsam::DecisionTree< L, Y >::Choice< L, Y >::Choice ( const L label,
size_t  count 
)
inline

Constructor, given choice label and mandatory expected branch count.

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

◆ Choice() [3/5]

template<typename L, typename Y>
template<typename L , typename Y >
gtsam::DecisionTree< L, Y >::Choice< L, Y >::Choice ( const Choice< L, Y > &  f,
const Choice< L, Y > &  g,
const Binary op 
)
inline

Construct from applying binary op to two Choice nodes.

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

◆ Choice() [4/5]

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 Unary op 
)
inline

Construct from applying unary op to a Choice node.

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

◆ Choice() [5/5]

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
labelThe label for this node.
fThe original choice node to apply the op on.
opFunction to apply on the choice node. Takes Assignment and value as arguments.
assignmentThe Assignment that will go to op.

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

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
inlineoverridevirtual

apply unary operator.

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

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

◆ 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
inlineoverridevirtual

Apply unary operator with assignment.

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

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

◆ 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
inlineoverridevirtual

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

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

◆ apply_fC_op_gL()

template<typename L, typename Y>
template<typename L , typename Y >
template<typename OP >
NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::apply_fC_op_gL ( const Leaf gL,
OP  op 
) const
inline

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

◆ 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
inlineoverridevirtual

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

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

◆ 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
inlineoverridevirtual

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

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

◆ branches()

template<typename L, typename Y>
template<typename L , typename Y >
const std::vector<NodePtr>& gtsam::DecisionTree< L, Y >::Choice< L, Y >::branches ( ) const
inline

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

◆ 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
inlineoverridevirtual

choose a branch, recursively

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

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

◆ 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
inlineoverridevirtual

output to graphviz (as a a graph)

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

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

◆ 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
inlineoverridevirtual

equality

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

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

◆ isLeaf()

template<typename L, typename Y>
template<typename L , typename Y >
bool gtsam::DecisionTree< L, Y >::Choice< L, Y >::isLeaf ( ) const
inlineoverridevirtual

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

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

◆ label()

template<typename L, typename Y>
template<typename L , typename Y >
const L& gtsam::DecisionTree< L, Y >::Choice< L, Y >::label ( ) const
inline

Return the label of this choice node.

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

◆ nrChoices()

template<typename L, typename Y>
template<typename L , typename Y >
size_t gtsam::DecisionTree< L, Y >::Choice< L, Y >::nrChoices ( ) const
inline

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

◆ 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
inlineoverridevirtual

evaluate

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

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

◆ 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
inlineoverridevirtual

print (as a tree).

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

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

◆ push_back()

template<typename L, typename Y>
template<typename L , typename Y >
void gtsam::DecisionTree< L, Y >::Choice< L, Y >::push_back ( const NodePtr node)
inline

add a branch: TODO merge into constructor

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

◆ 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
inlineoverridevirtual

Choice-Leaf equality: always false.

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

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

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

◆ Unique()

template<typename L, typename Y>
template<typename L , typename Y >
static NodePtr gtsam::DecisionTree< L, Y >::Choice< L, Y >::Unique ( const ChoicePtr f)
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.

Member Data Documentation

◆ allSame_

template<typename L, typename Y>
template<typename L , typename Y >
size_t gtsam::DecisionTree< L, Y >::Choice< L, Y >::allSame_
private

Incremental allSame. Records if all the branches are the same leaf.

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

◆ branches_

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

◆ label_

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


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:46:16