Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
Brush::Operator< NodeType::Constant, S, Fit > Struct Template Reference

#include <operator.h>

Public Types

using RetType = typename S::RetType
 
using W = typename S::WeightType
 
using ArgTypes
 set argument types to those of the signature unless:
 
using RetType
 return type of the operator
 
using NthType
 utility for returning the type of the Nth argument
 
using W
 set weight type
 

Public Member Functions

template<typename T = RetType, typename Scalar = T::Scalar, int N = T::NumDimensions>
RetType eval (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const
 
 Operator ()=default
 
get_kids (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const
 get a std::array or eigen array of kids
 
get_kids (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const
 get a std::tuple of kids. Used when child arguments are different types.
 
NthType< I > get_kid (const Dataset &d, TreeNode &tn, const W **weights) const
 gets one kid for a tuple of kids
 
get_kids_seq (const Dataset &d, TreeNode &tn, const W **weights, std::index_sequence< Is... >) const
 Makes and returns a tuple of child outputs.
 
RetType apply (const T &inputs) const
 Apply node function in a functional style.
 
RetType apply (const T &inputs) const
 Apply the node function like a function.
 
RetType eval (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const
 evaluate the operator on the data. main entry point.
 
RetType eval (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const
 

Static Public Attributes

static constexpr size_t ArgCount
 stores the argument count of the operator
 
static constexpr auto F
 wrapper function for the node function
 

Detailed Description

template<typename S, bool Fit>
struct Brush::Operator< NodeType::Constant, S, Fit >

Definition at line 310 of file operator.h.

Member Typedef Documentation

◆ ArgTypes

using Brush::Operator< NT, S, Fit, void >::ArgTypes

set argument types to those of the signature unless:

a) the operator is unary and there are more than one arguments b) the operator is binary and associative

In the case of a) or b), arguments to the operator are stacked into an array and the operator is applied to that array

Definition at line 86 of file operator.h.

◆ NthType

using Brush::Operator< NT, S, Fit, void >::NthType

utility for returning the type of the Nth argument

Definition at line 99 of file operator.h.

◆ RetType [1/2]

using Brush::Operator< NT, S, Fit, void >::RetType

return type of the operator

Definition at line 92 of file operator.h.

◆ RetType [2/2]

template<typename S, bool Fit>
using Brush::Operator< NodeType::Constant, S, Fit >::RetType = typename S::RetType

Definition at line 312 of file operator.h.

◆ W [1/2]

using Brush::Operator< NT, S, Fit, void >::W

set weight type

Definition at line 102 of file operator.h.

◆ W [2/2]

template<typename S, bool Fit>
using Brush::Operator< NodeType::Constant, S, Fit >::W = typename S::WeightType

Definition at line 313 of file operator.h.

Constructor & Destructor Documentation

◆ Operator()

Brush::Operator< NT, S, Fit, void >::Operator ( )
default

Member Function Documentation

◆ apply() [1/2]

RetType Brush::Operator< NT, S, Fit, void >::apply ( const T & inputs) const
inline

Apply node function in a functional style.

Template Parameters
Targument types
Parameters
inputsthe child node outputs
Returns
return values applying F to the inputs

Definition at line 195 of file operator.h.

◆ apply() [2/2]

RetType Brush::Operator< NT, S, Fit, void >::apply ( const T & inputs) const
inline

Apply the node function like a function.

Template Parameters
Targument types
Parameters
inputsthe child node outputs
Returns
return values applying F to the inputs

Definition at line 205 of file operator.h.

◆ eval() [1/3]

RetType Brush::Operator< NT, S, Fit, void >::eval ( const Dataset & d,
TreeNode & tn,
const W ** weights = nullptr ) const
inline

evaluate the operator on the data. main entry point.

Template Parameters
Targument types
Scalarthe underlying scalar type of the return type
Parameters
ddataset
tntree node
weightsoption pointer to a weight array, used in place of node weight
Returns
output values from applying operator function

Definition at line 218 of file operator.h.

◆ eval() [2/3]

RetType Brush::Operator< NT, S, Fit, void >::eval ( const Dataset & d,
TreeNode & tn,
const W ** weights = nullptr ) const
inline

Definition at line 235 of file operator.h.

◆ eval() [3/3]

template<typename S, bool Fit>
template<typename T = RetType, typename Scalar = T::Scalar, int N = T::NumDimensions>
RetType Brush::Operator< NodeType::Constant, S, Fit >::eval ( const Dataset & d,
TreeNode & tn,
const W ** weights = nullptr ) const
inline

Definition at line 316 of file operator.h.

Here is the call graph for this function:

◆ get_kid()

NthType< I > Brush::Operator< NT, S, Fit, void >::get_kid ( const Dataset & d,
TreeNode & tn,
const W ** weights ) const
inline

gets one kid for a tuple of kids

Definition at line 148 of file operator.h.

◆ get_kids() [1/2]

T Brush::Operator< NT, S, Fit, void >::get_kids ( const Dataset & d,
TreeNode & tn,
const W ** weights = nullptr ) const
inline

get a std::array or eigen array of kids

Definition at line 116 of file operator.h.

◆ get_kids() [2/2]

T Brush::Operator< NT, S, Fit, void >::get_kids ( const Dataset & d,
TreeNode & tn,
const W ** weights = nullptr ) const
inline

get a std::tuple of kids. Used when child arguments are different types.

Template Parameters
Targument types
Parameters
dthe dataset
tnthe tree node
weightsoption pointer to a weight array, used in place of node weight
Returns
a tuple of the child arguments

Definition at line 183 of file operator.h.

◆ get_kids_seq()

T Brush::Operator< NT, S, Fit, void >::get_kids_seq ( const Dataset & d,
TreeNode & tn,
const W ** weights,
std::index_sequence< Is... >  ) const
inline

Makes and returns a tuple of child outputs.

Template Parameters
Ta tuple
Isinteger sequence
Parameters
ddataset
tna tree node
Returns
a tuple with elements corresponding to each child node

Definition at line 171 of file operator.h.

Member Data Documentation

◆ ArgCount

size_t Brush::Operator< NT, S, Fit, void >::ArgCount
staticconstexpr

stores the argument count of the operator

Definition at line 95 of file operator.h.

◆ F

auto Brush::Operator< NT, S, Fit, void >::F
staticconstexpr

wrapper function for the node function

Definition at line 105 of file operator.h.


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