|
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::template 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 90 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 101 of file operator.h.
| using Brush::Operator< NT, S, Fit, E >::NthType = typename S::template NthType<N> |
utility for returning the type of the Nth argument
Definition at line 114 of file operator.h.
| using Brush::Operator< NT, S, Fit, E >::RetType = typename S::RetType |
return type of the operator
Definition at line 107 of file operator.h.
| using Brush::Operator< NT, S, Fit, E >::W = typename S::WeightType |
set weight type
Definition at line 117 of file operator.h.
|
default |
|
inline |
Apply node function in a functional style.
| T | argument types |
| inputs | the child node outputs |
Definition at line 210 of file operator.h.

|
inline |
Apply the node function like a function.
| T | argument types |
| inputs | the child node outputs |
Definition at line 220 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 233 of file operator.h.


|
inline |
gets one kid for a tuple of kids
Definition at line 163 of file operator.h.

|
inline |
get a std::array or eigen array of kids
Definition at line 131 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 198 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 186 of file operator.h.

|
staticconstexpr |
stores the argument count of the operator
Definition at line 110 of file operator.h.
|
staticconstexpr |
wrapper function for the node function
Definition at line 120 of file operator.h.