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

decision_tree_classification_model.h
1 /* file: decision_tree_classification_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the class defining the Decision tree classification model
45 //--
46 */
47 
48 #ifndef __DECISION_TREE_CLASSIFICATION_MODEL_H__
49 #define __DECISION_TREE_CLASSIFICATION_MODEL_H__
50 
51 #include "algorithms/classifier/classifier_model.h"
52 #include "algorithms/classifier/tree_traverse.h"
53 #include "data_management/data/aos_numeric_table.h"
54 #include "data_management/data/soa_numeric_table.h"
55 #include "data_management/data/homogen_numeric_table.h"
56 #include "decision_tree_model.h"
57 
58 namespace daal
59 {
60 namespace algorithms
61 {
62 
72 namespace decision_tree
73 {
74 
78 namespace classification
79 {
80 
85 enum SplitCriterion
86 {
87  gini = 0,
88  infoGain = 1
89 };
90 
94 namespace interface1
95 {
106 /* [Parameter source code] */
107 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::Parameter
108 {
113  Parameter(size_t nClasses = 2) : daal::algorithms::classifier::Parameter(nClasses),
114  pruning(reducedErrorPruning), maxTreeDepth(0), minObservationsInLeafNodes(1),
115  splitCriterion(infoGain) {}
116 
120  services::Status check() const DAAL_C11_OVERRIDE;
121 
122  SplitCriterion splitCriterion;
123  Pruning pruning;
124  size_t maxTreeDepth;
125  size_t minObservationsInLeafNodes;
126 };
127 /* [Parameter source code] */
128 
138 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
139 {
140 public:
141  DECLARE_MODEL_IFACE(Model, classifier::Model);
142 
148  Model(size_t nFeatures = 0);
149 
155  static services::SharedPtr<Model> create(size_t nFeatures = 0, services::Status *stat = NULL);
156 
157  virtual ~Model();
158 
159  class ModelImpl;
160  typedef services::SharedPtr<ModelImpl> ModelImplPtr;
161 
166  const ModelImpl * impl() const { return _impl.get(); }
167 
172  ModelImpl * impl() { return _impl.get(); }
173 
178  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
179 
184  void traverseDF(classifier::TreeNodeVisitor& visitor) const;
185 
190  void traverseBF(classifier::TreeNodeVisitor& visitor) const;
191 
192 protected:
193  Model(size_t nFeatures, services::Status &st);
194 
195  services::Status serializeImpl(data_management::InputDataArchive * arch) DAAL_C11_OVERRIDE;
196 
197  services::Status deserializeImpl(const data_management::OutputDataArchive * arch) DAAL_C11_OVERRIDE;
198 
199 private:
200  ModelImplPtr _impl;
201 };
202 
203 typedef services::SharedPtr<Model> ModelPtr;
204 typedef services::SharedPtr<const Model> ModelConstPtr;
205 
206 } // namespace interface1
207 
208 using interface1::Parameter;
209 using interface1::Model;
210 using interface1::ModelPtr;
211 using interface1::ModelConstPtr;
212 
214 } // namespace classification
215 } // namespace decision_tree
216 } // namespace algorithms
217 } // namespace daal
218 
219 #endif
daal::algorithms::decision_tree::classification::interface1::Parameter::minObservationsInLeafNodes
size_t minObservationsInLeafNodes
Definition: decision_tree_classification_model.h:125
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::classifier::interface1::Parameter
Base class for the parameters of the classification algorithm.
Definition: classifier_model.h:81
daal::data_management::interface1::InputDataArchive
Provides methods to create an archive data object (serialized) and access this object.
Definition: data_archive.h:715
daal::algorithms::decision_tree::classification::interface1::Parameter::pruning
Pruning pruning
Definition: decision_tree_classification_model.h:123
daal::algorithms::decision_tree::classification::interface1::Parameter::splitCriterion
SplitCriterion splitCriterion
Definition: decision_tree_classification_model.h:122
daal::algorithms::decision_tree::classification::SplitCriterion
SplitCriterion
Split criterion for Decision tree classification algorithm.
Definition: decision_tree_classification_model.h:85
daal::algorithms::decision_tree::classification::interface1::Model
Base class for models trained with the Decision tree algorithm
Definition: decision_tree_classification_model.h:138
daal::algorithms::decision_tree::classification::interface1::Model::impl
const ModelImpl * impl() const
Definition: decision_tree_classification_model.h:166
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::classifier::interface1::Model
Base class for the model of the classification algorithm.
Definition: classifier_model.h:95
daal::algorithms::decision_tree::reducedErrorPruning
Definition: decision_tree_model.h:76
daal::algorithms::decision_tree::classification::infoGain
Definition: decision_tree_classification_model.h:88
daal::data_management::interface1::OutputDataArchive
Provides methods to restore an object from its serialized counterpart and access the restored object...
Definition: data_archive.h:978
daal::algorithms::decision_tree::classification::interface1::Parameter
Decision tree algorithm parameters.
Definition: decision_tree_classification_model.h:107
daal::algorithms::decision_tree::classification::gini
Definition: decision_tree_classification_model.h:87
daal::algorithms::decision_tree::classification::interface1::Model::impl
ModelImpl * impl()
Definition: decision_tree_classification_model.h:172
daal::algorithms::decision_tree::classification::interface1::Parameter::maxTreeDepth
size_t maxTreeDepth
Definition: decision_tree_classification_model.h:124
daal::algorithms::decision_tree::classification::interface1::Parameter::Parameter
Parameter(size_t nClasses=2)
Definition: decision_tree_classification_model.h:113
daal::algorithms::decision_tree::Pruning
Pruning
Pruning method for Decision tree algorithm.
Definition: decision_tree_model.h:73
daal::algorithms::classifier::interface1::TreeNodeVisitor
Interface of abstract visitor used in tree traversal methods.
Definition: classifier/tree_traverse.h:82

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