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 (bool include_const=true) 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
 
void set_feature_type (DataType ft)
 
DataType get_feature_type () const
 
void set_keep_split_feature (bool keep)
 
bool get_keep_split_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
 
NodeType node_type
 the node type
 
DataType ret_type
 return data type
 
std::vector< DataTypearg_types
 argument data types
 
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)
 
bool fixed
 whether the node is replaceable. Weights are still optimized.
 
bool is_weighted
 whether this node is weighted (ignored in nodes that must have weights, such as meanLabel, constants, splits)
 
float prob_change
 chance of node being selected for variation
 
float W
 the weights of the node. also used for splitting thresholds.
 
bool center_op
 whether to center the operator in pretty printing
 
string feature
 feature name for terminals or splitting nodes
 
DataType feature_type = DataType::ArrayF
 feature type for terminals or splitting nodes
 
bool keep_split_feature = false
 fix the SplitBest feature when the node is fixed
 

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<
size_t,
bool,
string,
bool,
int
>
std::underlying_type_t< NodeType > UnderlyingNodeType
Definition nodetype.h:114

tuple type for hashing

Definition at line 115 of file node.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

Brush::Node::Node ( )
default
Here is the caller graph for this function:

◆ 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 134 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 180 of file node.h.

Here is the caller graph for this function:

◆ get_arg_count()

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

Definition at line 182 of file node.h.

◆ get_arg_types()

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

Definition at line 181 of file node.h.

Here is the caller graph for this function:

◆ get_feature()

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

Definition at line 259 of file node.h.

Here is the caller graph for this function:

◆ get_feature_type()

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

Definition at line 262 of file node.h.

Here is the caller graph for this function:

◆ get_is_weighted()

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

Definition at line 269 of file node.h.

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

◆ get_keep_split_feature()

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

Definition at line 265 of file node.h.

◆ get_model()

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

Definition at line 52 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:
Here is the caller graph for this function:

◆ get_node_hash()

size_t Brush::Node::get_node_hash ( bool include_const = true) const
inline

Definition at line 196 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 254 of file node.h.

Here is the caller graph for this function:

◆ get_prob_keep()

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

Definition at line 256 of file node.h.

◆ get_ret_type()

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

Definition at line 179 of file node.h.

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

◆ init()

void Brush::Node::init ( )
inline

Definition at line 157 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 224 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 229 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 236 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 213 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 241 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 246 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 258 of file node.h.

◆ set_feature_type()

void Brush::Node::set_feature_type ( DataType ft)
inline

Definition at line 261 of file node.h.

◆ set_is_weighted()

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

Definition at line 274 of file node.h.

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

◆ set_keep_split_feature()

void Brush::Node::set_keep_split_feature ( bool keep)
inline

Definition at line 264 of file node.h.

◆ set_prob_change()

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

Definition at line 255 of file node.h.

Here is the caller graph for this function:

◆ set_signature()

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

Definition at line 148 of file node.h.

Here is the caller graph for this function:

Member Data Documentation

◆ arg_types

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

argument data types

Definition at line 94 of file node.h.

◆ center_op

bool Brush::Node::center_op

whether to center the operator in pretty printing

Definition at line 110 of file node.h.

◆ feature

string Brush::Node::feature

feature name for terminals or splitting nodes

Definition at line 281 of file node.h.

◆ feature_type

DataType Brush::Node::feature_type = DataType::ArrayF

feature type for terminals or splitting nodes

Definition at line 284 of file node.h.

◆ fixed

bool Brush::Node::fixed

whether the node is replaceable. Weights are still optimized.

Definition at line 101 of file node.h.

◆ is_weighted

bool Brush::Node::is_weighted

whether this node is weighted (ignored in nodes that must have weights, such as meanLabel, constants, splits)

Definition at line 103 of file node.h.

◆ keep_split_feature

bool Brush::Node::keep_split_feature = false

fix the SplitBest feature when the node is fixed

Definition at line 287 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 89 of file node.h.

◆ prob_change

float Brush::Node::prob_change

chance of node being selected for variation

Definition at line 105 of file node.h.

◆ ret_type

DataType Brush::Node::ret_type

return data type

Definition at line 92 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 98 of file node.h.

◆ sig_hash

std::size_t Brush::Node::sig_hash

a hash of the signature

Definition at line 96 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: