Represents a node in the syntax tree.
More...
#include <node.h>
|
| enum class | type : uint32_t {
variable = 0
, constant
, functions_begin
, binary_begin = functions_begin
,
add = binary_begin
, atan2
, div
, fdim
,
max
, min
, mul
, pow
,
sub
, binary_end = sub
, unary_begin
, abs = unary_begin
,
acos
, acosh
, asin
, asinh
,
atan
, atanh
, cbrt
, cos
,
cosh
, cube
, exp
, inv
,
log
, neg
, rcbrt
, rsqrt
,
sin
, sinh
, sq
, sqrt
,
tan
, tanh
, unary_end = tanh
, functions_end = unary_end
} |
| | All possible types of nodes. For simplicity, all the terminal and non-terminal types are clubbed together. More...
|
| |
|
| static type | from_str (const std::string &ntype) |
| | Helper method to get node type from input string. More...
|
| |
Represents a node in the syntax tree.
float const_value = 2.f;
node const_node{const_value};
node()
Default constructor for node.
◆ type
All possible types of nodes. For simplicity, all the terminal and non-terminal types are clubbed together.
| Enumerator |
|---|
| variable | |
| constant | |
| functions_begin | |
| binary_begin | |
| add | |
| atan2 | |
| div | |
| fdim | |
| max | |
| min | |
| mul | |
| pow | |
| sub | |
| binary_end | |
| unary_begin | |
| abs | |
| acos | |
| acosh | |
| asin | |
| asinh | |
| atan | |
| atanh | |
| cbrt | |
| cos | |
| cosh | |
| cube | |
| exp | |
| inv | |
| log | |
| neg | |
| rcbrt | |
| rsqrt | |
| sin | |
| sinh | |
| sq | |
| sqrt | |
| tan | |
| tanh | |
| unary_end | |
| functions_end | |
◆ node() [1/5]
| cuml::genetic::node::node |
( |
| ) |
|
|
explicit |
Default constructor for node.
◆ node() [2/5]
| cuml::genetic::node::node |
( |
type |
ft | ) |
|
|
explicit |
Construct a function node.
- Parameters
-
◆ node() [3/5]
| cuml::genetic::node::node |
( |
int |
fid | ) |
|
|
explicit |
Construct a variable node.
- Parameters
-
| [in] | fid | feature id that represents the variable |
◆ node() [4/5]
| cuml::genetic::node::node |
( |
float |
val | ) |
|
|
explicit |
Construct a constant node.
- Parameters
-
◆ node() [5/5]
| cuml::genetic::node::node |
( |
const node & |
src | ) |
|
|
explicit |
- Parameters
-
| [in] | src | source node to be copied |
◆ arity()
| int cuml::genetic::node::arity |
( |
| ) |
const |
Get the arity of the node. If it is a terminal, then a 0 is returned
◆ from_str()
| static type cuml::genetic::node::from_str |
( |
const std::string & |
ntype | ) |
|
|
static |
Helper method to get node type from input string.
- Parameters
-
| [in] | ntype | node type in string. Possible strings correlate one-to-one with the enum values for type |
- Returns
type
◆ is_nonterminal()
| bool cuml::genetic::node::is_nonterminal |
( |
| ) |
const |
whether the current node is a function
◆ is_terminal()
| bool cuml::genetic::node::is_terminal |
( |
| ) |
const |
whether the current is either a variable or a constant
◆ operator=()
| node& cuml::genetic::node::operator= |
( |
const node & |
src | ) |
|
assignment operator
- Parameters
-
| [in] | src | source node to be copied |
- Returns
- current node reference
◆ fid
| int cuml::genetic::node::fid |
if the node is variable type, then this is the column id to be used to fetch its value, from the input dataset
◆ kInvalidFeatureId
| const int cuml::genetic::node::kInvalidFeatureId |
|
static |
constant used to represent invalid feature id
| type cuml::genetic::node::t |
| union { ... } cuml::genetic::node::u |
◆ val
| float cuml::genetic::node::val |
if the node is constant type, then this is the value of the node
The documentation for this struct was generated from the following file: