C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 4

decision_forest_classification_model_builder.h
1 /* file: decision_forest_classification_model_builder.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of class defining decision_forest classification model builder.
19 //--
20 */
21 #ifndef __DECISION_FOREST_CLASSIFICATION_MODEL_BUILDER_H__
22 #define __DECISION_FOREST_CLASSIFICATION_MODEL_BUILDER_H__
23 
24 #include "algorithms/decision_forest/decision_forest_classification_model.h"
25 
26 namespace daal
27 {
28 namespace algorithms
29 {
30 namespace decision_forest
31 {
40 namespace classification
41 {
42 
46 namespace interface1
47 {
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);
80  ModelBuilder(size_t nClasses, size_t nTrees)
81  {
82  _status |= initialize(nClasses, nTrees);
83  services::throwIfPossible(_status);
84  }
85 
91  TreeId createTree(size_t nNodes)
92  {
93  TreeId resId;
94  _status |= createTreeInternal(nNodes, resId);
95  services::throwIfPossible(_status);
96  return resId;
97  }
98 
107  NodeId addLeafNode(TreeId treeId, NodeId parentId, size_t position, size_t classLabel)
108  {
109  NodeId resId;
110  _status |= addLeafNodeInternal(treeId, parentId, position, classLabel, resId);
111  services::throwIfPossible(_status);
112  return resId;
113  }
114 
124  NodeId addSplitNode(TreeId treeId, NodeId parentId, size_t position, size_t featureIndex, double featureValue)
125  {
126  NodeId resId;
127  _status |= addSplitNodeInternal(treeId, parentId, position, featureIndex, featureValue, resId);
128  services::throwIfPossible(_status);
129  return resId;
130  }
131 
136  ModelPtr getModel()
137  {
138  services::throwIfPossible(_status);
139  return _model;
140  }
141 
146  services::Status getStatus()
147  {
148  return _status;
149  }
150 
151 protected:
152  ModelPtr _model;
153  services::Status _status;
154  services::Status initialize(size_t nClasses, size_t nTrees);
155  services::Status createTreeInternal(size_t nNodes, TreeId& resId);
156  services::Status addLeafNodeInternal(TreeId treeId, NodeId parentId, size_t position, size_t classLabel, NodeId& res);
157  services::Status addSplitNodeInternal(TreeId treeId, NodeId parentId, size_t position, size_t featureIndex, double featureValue, NodeId& res);
158 };
160 } // namespace interface1
161 using interface1::ModelBuilder;
162 
163 } // namespace classification
164 } // namespace decision_forest
165 } // namespace algorithms
166 } // namespace daal
167 #endif
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::getModel
ModelPtr getModel()
Definition: decision_forest_classification_model_builder.h:136
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::createTree
TreeId createTree(size_t nNodes)
Definition: decision_forest_classification_model_builder.h:91
daal
Definition: algorithm_base_common.h:31
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::NodeId
size_t NodeId
Node identifier type is size_t
Definition: decision_forest_classification_model_builder.h:66
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::ModelBuilder
ModelBuilder(size_t nClasses, size_t nTrees)
Definition: decision_forest_classification_model_builder.h:80
daal::algorithms::decision_forest::classification::interface1::ModelBuilder
Model Builder class for Decision Forest Classification Model algorithm
Definition: decision_forest_classification_model_builder.h:60
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::addSplitNode
NodeId addSplitNode(TreeId treeId, NodeId parentId, size_t position, size_t featureIndex, double featureValue)
Definition: decision_forest_classification_model_builder.h:124
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::addLeafNode
NodeId addLeafNode(TreeId treeId, NodeId parentId, size_t position, size_t classLabel)
Definition: decision_forest_classification_model_builder.h:107
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::TreeId
size_t TreeId
Tree identifier type is size_t
Definition: decision_forest_classification_model_builder.h:71
daal::algorithms::decision_forest::classification::interface1::ModelBuilder::getStatus
services::Status getStatus()
Definition: decision_forest_classification_model_builder.h:146

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