Brush C++ API
A flexible interpretable machine learning framework
|
Core computation of a node's function to data. More...
#include <operator.h>
Public Types | |
using | ArgTypes |
set argument types to those of the signature unless: | |
using | RetType = typename S::RetType |
return type of the operator | |
template<std::size_t N> | |
using | NthType = typename S::NthType<N> |
utility for returning the type of the Nth argument | |
using | W = typename S::WeightType |
set weight type | |
Public Member Functions | |
Operator ()=default | |
template<typename T = ArgTypes> requires (is_std_array_v<T> || is_eigen_array_v<T>) | |
T | get_kids (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const |
get a std::array or eigen array of kids | |
template<int I> | |
NthType< I > | get_kid (const Dataset &d, TreeNode &tn, const W **weights) const |
gets one kid for a tuple of kids | |
template<typename T , size_t ... Is> requires (is_tuple_v<T>) | |
T | get_kids_seq (const Dataset &d, TreeNode &tn, const W **weights, std::index_sequence< Is... >) const |
Makes and returns a tuple of child outputs. | |
template<typename T = ArgTypes> requires (is_tuple_v<T>) | |
T | 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. | |
template<typename T = ArgTypes> requires ( is_std_array_v<T> || is_tuple_v<T>) | |
RetType | apply (const T &inputs) const |
Apply node function in a functional style. | |
template<typename T = ArgTypes> requires ( is_eigen_array_v<T> && !is_std_array_v<T>) | |
RetType | apply (const T &inputs) const |
Apply the node function like a function. | |
template<typename T = ArgTypes, typename Scalar = RetType::Scalar> | |
RetType | eval (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const |
evaluate the operator on the data. main entry point. | |
template<typename T = ArgTypes, typename Scalar = RetType::Scalar> requires is_in_v<NT, NodeType::OffsetSum> | |
RetType | eval (const Dataset &d, TreeNode &tn, const W **weights=nullptr) const |
Static Public Attributes | |
static constexpr size_t | ArgCount = S::ArgCount |
stores the argument count of the operator | |
static constexpr auto | F |
wrapper function for the node function | |
Core computation of a node's function to data.
S | the signature of the node |
NT | node type |
Fit | true: fit, false: predict |
E | used for node type specialization |
Definition at line 75 of file operator.h.
using Brush::Operator< NT, S, Fit, E >::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.
utility for returning the type of the Nth argument
Definition at line 99 of file operator.h.
return type of the operator
Definition at line 92 of file operator.h.
set weight type
Definition at line 102 of file operator.h.
|
default |
Apply node function in a functional style.
T | argument types |
inputs | the child node outputs |
Definition at line 192 of file operator.h.
Apply the node function like a function.
T | argument types |
inputs | the child node outputs |
Definition at line 202 of file operator.h.
|
inline |
evaluate the operator on the data. main entry point.
T | argument types |
Scalar | the underlying scalar type of the return type |
d | dataset |
tn | tree node |
weights | option pointer to a weight array, used in place of node weight |
Definition at line 215 of file operator.h.
|
inline |
gets one kid for a tuple of kids
Definition at line 148 of file operator.h.
|
inline |
get a std::array or eigen array of kids
Definition at line 116 of file operator.h.
|
inline |
get a std::tuple of kids. Used when child arguments are different types.
T | argument types |
d | the dataset |
tn | the tree node |
weights | option pointer to a weight array, used in place of node weight |
Definition at line 180 of file operator.h.
|
inline |
Makes and returns a tuple of child outputs.
T | a tuple |
Is | integer sequence |
d | dataset |
tn | a tree node |
Definition at line 168 of file operator.h.
stores the argument count of the operator
Definition at line 95 of file operator.h.
wrapper function for the node function
Definition at line 105 of file operator.h.