Node
-
struct Node
class holding the data for a node in a tree.
Public Types
-
using HashTuple = std::tuple<UnderlyingNodeType, size_t, bool, string, bool, int>
tuple type for hashing
Public Functions
-
Node() = default
-
template<typename S>
inline explicit Node(NodeType type, S signature, bool weighted = false, string feature_name = "") noexcept Constructor used by search space.
- Template Parameters:
S – signature
- Parameters:
type – node type
feature_name – name of the terminal
signature – signature
-
template<typename S>
inline void set_signature()
-
inline void init()
-
string 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_weight – whether to include the node’s weight in the output.
- Returns:
string version of the node.
- Returns:
name
-
string get_model(const vector<string>&) const noexcept
-
inline DataType get_ret_type() const
-
inline std::size_t args_type() const
-
inline auto get_arg_types() const
-
inline size_t get_arg_count() const
-
inline size_t get_node_hash(bool include_const = true) const
-
inline float get_prob_change() const
-
inline void set_prob_change(float w)
-
inline float get_prob_keep() const
-
inline void set_feature(string f)
-
inline string get_feature() const
-
inline void set_feature_type(DataType ft)
-
inline DataType get_feature_type() const
-
inline void set_keep_split_feature(bool keep)
-
inline bool get_keep_split_feature() const
-
inline bool get_is_weighted() const
-
inline void set_is_weighted(bool is_weighted)
Public Members
-
string name
full name of the node, with types
-
DataType ret_type
return data type
-
std::vector<DataType> arg_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
-
using HashTuple = std::tuple<UnderlyingNodeType, size_t, bool, string, bool, int>