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, 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. Multiplications by one are omitted.
- 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 node_is_fixed
whether the node is replaceable. Weights are still optimized.
-
bool weight_is_fixed
whether the weight should be kept during variation. Notice that weight_is_fixed alows us to fix the weight of certain nodes.
-
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. This will take into account if the node is fixed, but not the weight (a fixed weight just gets propagated). Can be affected by node_is_fixed. should not be accessed directly.
-
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, bool, int>