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

decision_tree_classification_model.h
1 /* file: decision_tree_classification_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 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 using namespace daal::services;
59 
60 namespace daal
61 {
62 namespace algorithms
63 {
64 
74 namespace decision_tree
75 {
76 
80 namespace classification
81 {
82 
87 enum SplitCriterion
88 {
89  gini = 0,
90  infoGain = 1
91 };
92 
96 namespace interface1
97 {
108 /* [Parameter source code] */
109 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::Parameter
110 {
115  Parameter(size_t nClasses = 2) : daal::algorithms::classifier::Parameter(nClasses),
116  pruning(reducedErrorPruning), maxTreeDepth(0), minObservationsInLeafNodes(1),
117  splitCriterion(infoGain) {}
118 
122  services::Status check() const DAAL_C11_OVERRIDE;
123 
124  SplitCriterion splitCriterion;
125  Pruning pruning;
126  size_t maxTreeDepth;
127  size_t minObservationsInLeafNodes;
128 };
129 /* [Parameter source code] */
130 
140 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
141 {
142 public:
143  DECLARE_MODEL_IFACE(Model, classifier::Model);
144 
150  Model(size_t nFeatures = 0);
151 
157  static services::SharedPtr<Model> create(size_t nFeatures = 0, services::Status *stat = NULL);
158 
159  virtual ~Model();
160 
161  class ModelImpl;
162  typedef services::SharedPtr<ModelImpl> ModelImplPtr;
163 
168  const ModelImpl * impl() const { return _impl.get(); }
169 
174  ModelImpl * impl() { return _impl.get(); }
175 
180  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
181 
186  void traverseDF(classifier::TreeNodeVisitor& visitor) const;
187 
192  void traverseBF(classifier::TreeNodeVisitor& visitor) const;
193 
194 protected:
195  Model(size_t nFeatures, services::Status &st);
196 
197  services::Status serializeImpl(data_management::InputDataArchive * arch) DAAL_C11_OVERRIDE;
198 
199  services::Status deserializeImpl(const data_management::OutputDataArchive * arch) DAAL_C11_OVERRIDE;
200 
201 private:
202  ModelImplPtr _impl;
203 };
204 
205 typedef services::SharedPtr<Model> ModelPtr;
206 typedef services::SharedPtr<const Model> ModelConstPtr;
207 
208 } // namespace interface1
209 
210 using interface1::Parameter;
211 using interface1::Model;
212 using interface1::ModelPtr;
213 using interface1::ModelConstPtr;
214 
216 } // namespace classification
217 } // namespace decision_tree
218 } // namespace algorithms
219 } // namespace daal
220 
221 #endif
daal
Definition: algorithm_base_common.h:57
daal::algorithms::decision_tree::reducedErrorPruning
Definition: decision_tree_model.h:76
daal::algorithms::decision_tree::classification::SplitCriterion
SplitCriterion
Split criterion for Decision tree classification algorithm.
Definition: decision_tree_classification_model.h:87
daal::algorithms::decision_tree::classification::interface1::Model
Base class for models trained with the Decision tree algorithm
Definition: decision_tree_classification_model.h:140
daal::algorithms::decision_tree::Pruning
Pruning
Pruning method for Decision tree algorithm.
Definition: decision_tree_model.h:73
daal::algorithms::decision_tree::classification::infoGain
Definition: decision_tree_classification_model.h:90
daal::algorithms::decision_tree::classification::interface1::Parameter
Decision tree algorithm parameters.
Definition: decision_tree_classification_model.h:109
daal::algorithms::decision_tree::classification::interface1::Model::impl
const ModelImpl * impl() const
Definition: decision_tree_classification_model.h:168
daal::algorithms::decision_tree::classification::gini
Definition: decision_tree_classification_model.h:89
daal::algorithms::decision_tree::classification::interface1::Model::impl
ModelImpl * impl()
Definition: decision_tree_classification_model.h:174
daal::algorithms::decision_tree::classification::interface1::Parameter::Parameter
Parameter(size_t nClasses=2)
Definition: decision_tree_classification_model.h:115
daal::services
Contains classes that implement service functionality, including error handling, memory allocation...
Definition: collection.h:51

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