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

decision_tree_classification_model.h
1 /* file: decision_tree_classification_model.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 the class defining the Decision tree classification model
19 //--
20 */
21 
22 #ifndef __DECISION_TREE_CLASSIFICATION_MODEL_H__
23 #define __DECISION_TREE_CLASSIFICATION_MODEL_H__
24 
25 #include "algorithms/classifier/classifier_model.h"
26 #include "algorithms/classifier/tree_traverse.h"
27 #include "data_management/data/aos_numeric_table.h"
28 #include "data_management/data/soa_numeric_table.h"
29 #include "data_management/data/homogen_numeric_table.h"
30 #include "decision_tree_model.h"
31 #include "algorithms/tree_utils/tree_utils_classification.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 
47 namespace decision_tree
48 {
49 
53 namespace classification
54 {
55 
60 enum SplitCriterion
61 {
62  gini = 0,
63  infoGain = 1
64 };
65 
69 namespace interface1
70 {
81 /* [Parameter source code] */
82 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::Parameter
83 {
88  Parameter(size_t nClasses = 2) : daal::algorithms::classifier::Parameter(nClasses),
89  pruning(reducedErrorPruning), maxTreeDepth(0), minObservationsInLeafNodes(1),
90  splitCriterion(infoGain) {}
91 
95  services::Status check() const DAAL_C11_OVERRIDE;
96 
97  SplitCriterion splitCriterion;
98  Pruning pruning;
99  size_t maxTreeDepth;
100  size_t minObservationsInLeafNodes;
101 };
102 /* [Parameter source code] */
103 
113 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
114 {
115 public:
116  DECLARE_MODEL_IFACE(Model, classifier::Model);
117 
123  Model(size_t nFeatures = 0);
124 
130  static services::SharedPtr<Model> create(size_t nFeatures = 0, services::Status *stat = NULL);
131 
132  virtual ~Model();
133 
134  class ModelImpl;
135  typedef services::SharedPtr<ModelImpl> ModelImplPtr;
136 
141  const ModelImpl * impl() const { return _impl.get(); }
142 
147  ModelImpl * impl() { return _impl.get(); }
148 
153  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
154 
160  void traverseDF(classifier::TreeNodeVisitor& visitor) const;
161 
167  void traverseBF(classifier::TreeNodeVisitor& visitor) const;
168 
173  void traverseDFS(tree_utils::classification::TreeNodeVisitor& visitor) const;
174 
179  void traverseBFS(tree_utils::classification::TreeNodeVisitor& visitor) const;
180 
181 protected:
182  Model(size_t nFeatures, services::Status &st);
183 
184  services::Status serializeImpl(data_management::InputDataArchive * arch) DAAL_C11_OVERRIDE;
185 
186  services::Status deserializeImpl(const data_management::OutputDataArchive * arch) DAAL_C11_OVERRIDE;
187 
188 private:
189  ModelImplPtr _impl;
190 };
191 
192 typedef services::SharedPtr<Model> ModelPtr;
193 typedef services::SharedPtr<const Model> ModelConstPtr;
194 
195 } // namespace interface1
196 
197 using interface1::Parameter;
198 using interface1::Model;
199 using interface1::ModelPtr;
200 using interface1::ModelConstPtr;
201 
203 } // namespace classification
204 } // namespace decision_tree
205 } // namespace algorithms
206 } // namespace daal
207 
208 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::decision_tree::reducedErrorPruning
Definition: decision_tree_model.h:50
daal::algorithms::decision_tree::classification::SplitCriterion
SplitCriterion
Split criterion for Decision tree classification algorithm.
Definition: decision_tree_classification_model.h:60
daal::algorithms::decision_tree::classification::interface1::Model
Base class for models trained with the Decision tree algorithm
Definition: decision_tree_classification_model.h:113
daal::algorithms::decision_tree::Pruning
Pruning
Pruning method for Decision tree algorithm.
Definition: decision_tree_model.h:47
daal::algorithms::decision_tree::classification::infoGain
Definition: decision_tree_classification_model.h:63
daal::algorithms::decision_tree::classification::interface1::Parameter
Decision tree algorithm parameters.
Definition: decision_tree_classification_model.h:82
daal::algorithms::decision_tree::classification::interface1::Model::impl
const ModelImpl * impl() const
Definition: decision_tree_classification_model.h:141
daal::algorithms::decision_tree::classification::gini
Definition: decision_tree_classification_model.h:62
daal::algorithms::decision_tree::classification::interface1::Model::impl
ModelImpl * impl()
Definition: decision_tree_classification_model.h:147
daal::algorithms::decision_tree::classification::interface1::Parameter::Parameter
Parameter(size_t nClasses=2)
Definition: decision_tree_classification_model.h:88

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