C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

gbt_classification_model_builder.h
1 /* file: gbt_classification_model_builder.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of class defining gradient boosting trees classification model builder.
21 //--
22 */
23 #ifndef __GBT_CLASSIFICATION_MODEL_BUILDER_H__
24 #define __GBT_CLASSIFICATION_MODEL_BUILDER_H__
25 
26 #include "algorithms/gradient_boosted_trees/gbt_classification_model.h"
27 
28 namespace daal
29 {
30 namespace algorithms
31 {
32 namespace gbt
33 {
42 namespace classification
43 {
47 namespace interface1
48 {
60 class DAAL_EXPORT ModelBuilder
61 {
62 public:
66  typedef size_t NodeId;
67 
71  typedef size_t TreeId;
72 
73  static const NodeId noParent = static_cast<size_t>(-1);
81  ModelBuilder(size_t nFeatures, size_t nIterations, size_t nClasses = 2)
82  {
83  _status |= initialize(nFeatures, nIterations, nClasses);
84  services::throwIfPossible(_status);
85  }
86 
93  TreeId createTree(size_t nNodes, size_t classLabel)
94  {
95  TreeId resId;
96  _status |= createTreeInternal(nNodes, classLabel, resId);
97  services::throwIfPossible(_status);
98  return resId;
99  }
100 
109  NodeId addLeafNode(TreeId treeId, NodeId parentId, size_t position, double response)
110  {
111  NodeId resId;
112  _status |= addLeafNodeInternal(treeId, parentId, position, response, resId);
113  services::throwIfPossible(_status);
114  return resId;
115  }
116 
126  NodeId addSplitNode(TreeId treeId, NodeId parentId, size_t position, size_t featureIndex, double featureValue)
127  {
128  NodeId resId;
129  _status |= addSplitNodeInternal(treeId, parentId, position, featureIndex, featureValue, resId);
130  services::throwIfPossible(_status);
131  return resId;
132  }
133 
138  ModelPtr getModel()
139  {
140  _status |= convertModelInternal();
141  services::throwIfPossible(_status);
142  return _model;
143  }
144 
149  services::Status getStatus()
150  {
151  return _status;
152  }
153 
154 protected:
155  ModelPtr _model;
156  services::Status _status;
157  services::Status initialize(size_t nFeatures, size_t nIterations, size_t nClasses);
158  services::Status createTreeInternal(size_t nNodes, size_t classLabel, TreeId& resId);
159  services::Status addLeafNodeInternal(TreeId treeId, NodeId parentId, size_t position, double response, NodeId& res);
160  services::Status addSplitNodeInternal(TreeId treeId, NodeId parentId, size_t position, size_t featureIndex, double featureValue, NodeId& res);
161  services::Status convertModelInternal();
162  size_t _nClasses;
163  size_t _nIterations;
164 
165 };
167 } // namespace interface1
168 using interface1::ModelBuilder;
169 
170 } // namespace classification
171 } // namespace gbt
172 } // namespace algorithms
173 } // namespace daal
174 #endif
daal::algorithms::gbt::classification::interface1::ModelBuilder::NodeId
size_t NodeId
Node identifier type is size_t
Definition: gbt_classification_model_builder.h:66
daal::algorithms::gbt::classification::interface1::ModelBuilder::TreeId
size_t TreeId
Tree identifier type is size_t
Definition: gbt_classification_model_builder.h:71
daal::algorithms::gbt::classification::interface1::ModelBuilder::ModelBuilder
ModelBuilder(size_t nFeatures, size_t nIterations, size_t nClasses=2)
Definition: gbt_classification_model_builder.h:81
daal::algorithms::gbt::classification::interface1::ModelBuilder::getModel
ModelPtr getModel()
Definition: gbt_classification_model_builder.h:138
daal::algorithms::gbt::classification::interface1::ModelBuilder::createTree
TreeId createTree(size_t nNodes, size_t classLabel)
Definition: gbt_classification_model_builder.h:93
daal::algorithms::gbt::classification::interface1::ModelBuilder::addLeafNode
NodeId addLeafNode(TreeId treeId, NodeId parentId, size_t position, double response)
Definition: gbt_classification_model_builder.h:109
daal::algorithms::gbt::classification::interface1::ModelBuilder
Model Builder class for gradient boosted trees classification model.
Definition: gbt_classification_model_builder.h:60
daal::algorithms::gbt::classification::interface1::ModelBuilder::getStatus
services::Status getStatus()
Definition: gbt_classification_model_builder.h:149
daal::algorithms::gbt::classification::interface1::ModelBuilder::addSplitNode
NodeId addSplitNode(TreeId treeId, NodeId parentId, size_t position, size_t featureIndex, double featureValue)
Definition: gbt_classification_model_builder.h:126
daal::algorithms::em_gmm::nIterations
Definition: em_gmm_types.h:99

For more complete information about compiler optimizations, see our Optimization Notice.