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

Public Member Functions

 Leaf ()
 Default constructor for serialization.
 Leaf (const Y &constant, size_t nrAssignments=1)
 Constructor from constant.
const Y & constant () const
 Return the constant.
size_t nrAssignments () const
 Return the number of assignments contained within this leaf.
bool sameLeaf (const Leaf &q) const override
 Leaf-Leaf equality.
bool sameLeaf (const Node &q) const override
 polymorphic equality: is q a leaf and is it the same as this leaf?
bool equals (const Node &q, const CompareFunc &compare) const override
 equality up to tolerance
void print (const std::string &s, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter) const override
 print
void dot (std::ostream &os, const LabelFormatter &labelFormatter, const ValueFormatter &valueFormatter, bool showZero) const override
 Write graphviz format to stream os.
const Y & operator() (const Assignment< L > &x) const override
 evaluate
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
NodePtr choose (const L &label, size_t index) const override
 choose a branch, create new memory !
bool isLeaf () const override
Public Member Functions inherited from gtsam::DecisionTree< L, Y >::Node
const void * id () const

Public Attributes

constant_
 constant stored in this leaf
size_t nrAssignments_
 The number of assignments contained within this leaf.

Additional Inherited Members

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

Member Function Documentation

◆ apply() [1/2]

template<typename L, typename Y>
template<typename L, typename Y>
NodePtr gtsam::DecisionTree< L, Y >::Leaf< L, Y >::apply ( const Unary & op) const
inlineoverridevirtual

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 >::Leaf< L, Y >::apply ( const UnaryAssignment & op,
const Assignment< L > & assignment ) const
inlineoverridevirtual

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 >::Leaf< L, Y >::apply_f_op_g ( const Node & g,
const Binary & op ) const
inlineoverridevirtual

◆ apply_g_op_fC()

template<typename L, typename Y>
template<typename L, typename Y>
NodePtr gtsam::DecisionTree< L, Y >::Leaf< L, Y >::apply_g_op_fC ( const Choice & fC,
const Binary & op ) const
inlineoverridevirtual

◆ apply_g_op_fL()

template<typename L, typename Y>
template<typename L, typename Y>
NodePtr gtsam::DecisionTree< L, Y >::Leaf< L, Y >::apply_g_op_fL ( const Leaf< L, Y > & fL,
const Binary & op ) const
inlineoverridevirtual

◆ choose()

template<typename L, typename Y>
template<typename L, typename Y>
NodePtr gtsam::DecisionTree< L, Y >::Leaf< L, Y >::choose ( const L & label,
size_t index ) const
inlineoverridevirtual

choose a branch, create new memory !

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

◆ dot()

template<typename L, typename Y>
template<typename L, typename Y>
void gtsam::DecisionTree< L, Y >::Leaf< L, Y >::dot ( std::ostream & os,
const LabelFormatter & labelFormatter,
const ValueFormatter & valueFormatter,
bool showZero ) const
inlineoverridevirtual

Write graphviz format to stream os.

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

◆ equals()

template<typename L, typename Y>
template<typename L, typename Y>
bool gtsam::DecisionTree< L, Y >::Leaf< L, Y >::equals ( const Node & q,
const CompareFunc & compare ) const
inlineoverridevirtual

equality up to tolerance

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

◆ isLeaf()

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

◆ operator()()

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

evaluate

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

◆ print()

template<typename L, typename Y>
template<typename L, typename Y>
void gtsam::DecisionTree< L, Y >::Leaf< L, Y >::print ( const std::string & s,
const LabelFormatter & labelFormatter,
const ValueFormatter & valueFormatter ) const
inlineoverridevirtual

◆ sameLeaf() [1/2]

template<typename L, typename Y>
template<typename L, typename Y>
bool gtsam::DecisionTree< L, Y >::Leaf< L, Y >::sameLeaf ( const Leaf< L, Y > & q) const
inlineoverridevirtual

Leaf-Leaf equality.

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

◆ sameLeaf() [2/2]

template<typename L, typename Y>
template<typename L, typename Y>
bool gtsam::DecisionTree< L, Y >::Leaf< L, Y >::sameLeaf ( const Node & q) const
inlineoverridevirtual

polymorphic equality: is q a leaf and is it the same as this leaf?

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

Member Data Documentation

◆ nrAssignments_

template<typename L, typename Y>
template<typename L, typename Y>
size_t gtsam::DecisionTree< L, Y >::Leaf< L, Y >::nrAssignments_

The number of assignments contained within this leaf.

Particularly useful when leaves have been pruned.


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