OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DecisionTreeEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
20  double value;
21  int64_t feature_index;
24 
25  // Constructor for a split node. Note that right_child_row_idx won't
26  // be known until later in the depth-first traversal that constructs
27  // the table of DecisionTreeEntrys, at which point that value will
28  // be populated
29  DecisionTreeEntry(const double value,
30  const int64_t feature_index,
31  const int64_t left_child_row_idx)
32  : value(value)
33  , feature_index(feature_index)
34  , left_child_row_idx(left_child_row_idx) {}
35 
36  // Constructor for a terminal/non-split node
37  DecisionTreeEntry(const double value) : value(value), feature_index(-1) {}
38 
39  inline bool isSplitNode() const { return feature_index >= 0; }
40 };
double value
int64_t left_child_row_idx
int64_t feature_index
DecisionTreeEntry(const double value)
DecisionTreeEntry(const double value, const int64_t feature_index, const int64_t left_child_row_idx)
bool isSplitNode() const
int64_t right_child_row_idx