Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
Brush::Node Struct Reference

class holding the data for a node in a tree. More...

#include <node.h>

Collaboration diagram for Brush::Node:

Public Types

using HashTuple
 tuple type for hashing
 

Public Member Functions

 Node ()=default
 
template<typename S >
 Node (NodeType type, S signature, bool weighted=false, string feature_name="") noexcept
 Constructor used by search space.
 
template<typename S >
void set_signature ()
 
void init ()
 
string get_name (bool include_weight=true) const noexcept
 gets a string version of the node for printing.
 
string get_model (const vector< string > &) const noexcept
 
DataType get_ret_type () const
 
std::size_t args_type () const
 
auto get_arg_types () const
 
size_t get_arg_count () const
 
size_t get_node_hash () const
 
auto operator== (const Node &rhs) const noexcept -> bool
 
auto operator!= (const Node &rhs) const noexcept -> bool
 
auto operator< (const Node &rhs) const noexcept -> bool
 
auto operator<= (const Node &rhs) const noexcept -> bool
 
auto operator> (const Node &rhs) const noexcept -> bool
 
auto operator>= (const Node &rhs) const noexcept -> bool
 
float get_prob_change () const
 
void set_prob_change (float w)
 
float get_prob_keep () const
 
void set_feature (string f)
 
string get_feature () const
 
bool get_is_weighted () const
 
void set_is_weighted (bool is_weighted)
 

Public Attributes

string name
 full name of the node, with types
 
bool center_op
 whether to center the operator in pretty printing
 
float prob_change
 chance of node being selected for variation
 
bool fixed
 whether node is modifiable
 
NodeType node_type
 the node type
 
std::size_t sig_hash
 a hash of the signature
 
std::size_t sig_dual_hash
 a hash of the dual of the signature (for NLS)
 
DataType ret_type
 return data type
 
std::vector< DataTypearg_types
 argument data types
 
bool is_weighted
 whether this node is weighted
 
float W
 the weights of the node. also used for splitting thresholds.
 

Private Attributes

string feature
 feature name for terminals or splitting nodes
 

Detailed Description

class holding the data for a node in a tree.

Definition at line 84 of file node.h.

Member Typedef Documentation

◆ HashTuple

Initial value:
std::tuple<
bool,
string,
bool,
int
>
void bind_engine(py::module &m, string name)
std::underlying_type_t< NodeType > UnderlyingNodeType
Definition nodetype.h:112

tuple type for hashing

Definition at line 111 of file node.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

Brush::Node::Node ( )
default

◆ Node() [2/2]

template<typename S >
Brush::Node::Node ( NodeType type,
S signature,
bool weighted = false,
string feature_name = "" )
inlineexplicitnoexcept

Constructor used by search space.

Template Parameters
Ssignature
Parameters
typenode type
feature_namename of the terminal
signaturesignature

Definition at line 131 of file node.h.

Here is the call graph for this function:

Member Function Documentation

◆ args_type()

std::size_t Brush::Node::args_type ( ) const
inline

Definition at line 174 of file node.h.

◆ get_arg_count()

size_t Brush::Node::get_arg_count ( ) const
inline

Definition at line 176 of file node.h.

◆ get_arg_types()

auto Brush::Node::get_arg_types ( ) const
inline

Definition at line 175 of file node.h.

◆ get_feature()

string Brush::Node::get_feature ( ) const
inline

Definition at line 244 of file node.h.

◆ get_is_weighted()

bool Brush::Node::get_is_weighted ( ) const
inline

Definition at line 246 of file node.h.

◆ get_model()

string Brush::Node::get_model ( const vector< string > & children) const
noexcept

Definition at line 50 of file node.cpp.

Here is the call graph for this function:

◆ get_name()

auto Brush::Node::get_name ( bool include_weight = true) const
noexcept

gets a string version of the node for printing.

get the name of the node.

Parameters
include_weightwhether to include the node's weight in the output.
Returns
string version of the node.
name

Definition at line 20 of file node.cpp.

Here is the call graph for this function:

◆ get_node_hash()

size_t Brush::Node::get_node_hash ( ) const
inline

Definition at line 190 of file node.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_prob_change()

float Brush::Node::get_prob_change ( ) const
inline

Definition at line 239 of file node.h.

◆ get_prob_keep()

float Brush::Node::get_prob_keep ( ) const
inline

Definition at line 241 of file node.h.

◆ get_ret_type()

DataType Brush::Node::get_ret_type ( ) const
inline

Definition at line 173 of file node.h.

◆ init()

void Brush::Node::init ( )
inline

Definition at line 154 of file node.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

auto Brush::Node::operator!= ( const Node & rhs) const -> bool
inlinenoexcept

Definition at line 209 of file node.h.

Here is the call graph for this function:

◆ operator<()

auto Brush::Node::operator< ( const Node & rhs) const -> bool
inlinenoexcept

Definition at line 214 of file node.h.

Here is the call graph for this function:

◆ operator<=()

auto Brush::Node::operator<= ( const Node & rhs) const -> bool
inlinenoexcept

Definition at line 221 of file node.h.

Here is the call graph for this function:

◆ operator==()

auto Brush::Node::operator== ( const Node & rhs) const -> bool
inlinenoexcept

Definition at line 202 of file node.h.

Here is the call graph for this function:

◆ operator>()

auto Brush::Node::operator> ( const Node & rhs) const -> bool
inlinenoexcept

Definition at line 226 of file node.h.

Here is the call graph for this function:

◆ operator>=()

auto Brush::Node::operator>= ( const Node & rhs) const -> bool
inlinenoexcept

Definition at line 231 of file node.h.

Here is the call graph for this function:

◆ set_feature()

void Brush::Node::set_feature ( string f)
inline

Definition at line 243 of file node.h.

Here is the call graph for this function:

◆ set_is_weighted()

void Brush::Node::set_is_weighted ( bool is_weighted)
inline

Definition at line 247 of file node.h.

Here is the call graph for this function:

◆ set_prob_change()

void Brush::Node::set_prob_change ( float w)
inline

Definition at line 240 of file node.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_signature()

template<typename S >
void Brush::Node::set_signature ( )
inline

Definition at line 145 of file node.h.

Member Data Documentation

◆ arg_types

std::vector<DataType> Brush::Node::arg_types

argument data types

Definition at line 103 of file node.h.

◆ center_op

bool Brush::Node::center_op

whether to center the operator in pretty printing

Definition at line 89 of file node.h.

◆ feature

string Brush::Node::feature
private

feature name for terminals or splitting nodes

Definition at line 256 of file node.h.

◆ fixed

bool Brush::Node::fixed

whether node is modifiable

Definition at line 93 of file node.h.

◆ is_weighted

bool Brush::Node::is_weighted

whether this node is weighted

Definition at line 105 of file node.h.

◆ name

string Brush::Node::name

full name of the node, with types

Definition at line 87 of file node.h.

◆ node_type

NodeType Brush::Node::node_type

the node type

Definition at line 95 of file node.h.

◆ prob_change

float Brush::Node::prob_change

chance of node being selected for variation

Definition at line 91 of file node.h.

◆ ret_type

DataType Brush::Node::ret_type

return data type

Definition at line 101 of file node.h.

◆ sig_dual_hash

std::size_t Brush::Node::sig_dual_hash

a hash of the dual of the signature (for NLS)

Definition at line 99 of file node.h.

◆ sig_hash

std::size_t Brush::Node::sig_hash

a hash of the signature

Definition at line 97 of file node.h.

◆ W

float Brush::Node::W

the weights of the node. also used for splitting thresholds.

Definition at line 107 of file node.h.


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