C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 3

decision_tree_classification_model.h
1 /* file: decision_tree_classification_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 
46 namespace decision_tree
47 {
48 
52 namespace classification
53 {
54 
59 enum SplitCriterion
60 {
61  gini = 0,
62  infoGain = 1
63 };
64 
68 namespace interface1
69 {
80 /* [Parameter source code] */
81 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::Parameter
82 {
87  Parameter(size_t nClasses = 2) : daal::algorithms::classifier::Parameter(nClasses),
88  pruning(reducedErrorPruning), maxTreeDepth(0), minObservationsInLeafNodes(1),
89  splitCriterion(infoGain) {}
90 
94  services::Status check() const DAAL_C11_OVERRIDE;
95 
96  SplitCriterion splitCriterion;
97  Pruning pruning;
98  size_t maxTreeDepth;
99  size_t minObservationsInLeafNodes;
100 };
101 /* [Parameter source code] */
102 
112 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
113 {
114 public:
115  DECLARE_MODEL_IFACE(Model, classifier::Model);
116 
122  Model(size_t nFeatures = 0);
123 
129  static services::SharedPtr<Model> create(size_t nFeatures = 0, services::Status *stat = NULL);
130 
131  virtual ~Model();
132 
133  class ModelImpl;
134  typedef services::SharedPtr<ModelImpl> ModelImplPtr;
135 
140  const ModelImpl * impl() const { return _impl.get(); }
141 
146  ModelImpl * impl() { return _impl.get(); }
147 
152  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
153 
158  void traverseDF(classifier::TreeNodeVisitor& visitor) const;
159 
164  void traverseBF(classifier::TreeNodeVisitor& visitor) const;
165 
166 protected:
167  Model(size_t nFeatures, services::Status &st);
168 
169  services::Status serializeImpl(data_management::InputDataArchive * arch) DAAL_C11_OVERRIDE;
170 
171  services::Status deserializeImpl(const data_management::OutputDataArchive * arch) DAAL_C11_OVERRIDE;
172 
173 private:
174  ModelImplPtr _impl;
175 };
176 
177 typedef services::SharedPtr<Model> ModelPtr;
178 typedef services::SharedPtr<const Model> ModelConstPtr;
179 
180 } // namespace interface1
181 
182 using interface1::Parameter;
183 using interface1::Model;
184 using interface1::ModelPtr;
185 using interface1::ModelConstPtr;
186 
188 } // namespace classification
189 } // namespace decision_tree
190 } // namespace algorithms
191 } // namespace daal
192 
193 #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:59
daal::algorithms::decision_tree::classification::interface1::Model
Base class for models trained with the Decision tree algorithm
Definition: decision_tree_classification_model.h:112
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:62
daal::algorithms::decision_tree::classification::interface1::Parameter
Decision tree algorithm parameters.
Definition: decision_tree_classification_model.h:81
daal::algorithms::decision_tree::classification::interface1::Model::impl
const ModelImpl * impl() const
Definition: decision_tree_classification_model.h:140
daal::algorithms::decision_tree::classification::gini
Definition: decision_tree_classification_model.h:61
daal::algorithms::decision_tree::classification::interface1::Model::impl
ModelImpl * impl()
Definition: decision_tree_classification_model.h:146
daal::algorithms::decision_tree::classification::interface1::Parameter::Parameter
Parameter(size_t nClasses=2)
Definition: decision_tree_classification_model.h:87

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