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

decision_tree_classification_predict.h
1 /* file: decision_tree_classification_predict.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 interface for Decision tree classification model-based prediction
19 //--
20 */
21 
22 #ifndef __DECISION_TREE_CLASSIFICATION_PREDICT_H__
23 #define __DECISION_TREE_CLASSIFICATION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/decision_tree/decision_tree_classification_predict_types.h"
27 #include "algorithms/decision_tree/decision_tree_classification_model.h"
28 #include "algorithms/classifier/classifier_predict.h"
29 #include "data_management/data/homogen_numeric_table.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace decision_tree
36 {
37 namespace classification
38 {
39 namespace prediction
40 {
41 namespace interface1
42 {
53 template<typename algorithmFPType, Method method, CpuType cpu>
54 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
55 {
56 public:
61  BatchContainer(daal::services::Environment::env *daalEnv);
62 
63  ~BatchContainer();
64 
68  services::Status compute() DAAL_C11_OVERRIDE;
69 };
70 
87 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
88 class Batch : public classifier::prediction::Batch
89 {
90 public:
91  typedef classifier::prediction::Batch super;
92 
93  typedef algorithms::decision_tree::classification::prediction::Input InputType;
94  typedef algorithms::decision_tree::classification::Parameter ParameterType;
95  typedef typename super::ResultType ResultType;
96 
97  InputType input;
98  ParameterType parameter;
101  Batch() : classifier::prediction::Batch(), input(), parameter()
102  {
103  initialize();
104  }
105 
112  Batch(const Batch<algorithmFPType, method> & other) : classifier::prediction::Batch(other), input(other.input), parameter(other.parameter)
113  {
114  initialize();
115  }
116 
121  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
122 
127  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
128 
134  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
135  {
136  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
137  }
138 
139 protected:
140  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
141  {
142  return new Batch<algorithmFPType, method>(*this);
143  }
144 
145  services::Status allocateResult() DAAL_C11_OVERRIDE
146  {
147  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, (int)method);
148  _res = _result.get();
149  return s;
150  }
151 
152  void initialize()
153  {
154  _in = &input;
155  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
156  _par = &parameter;
157  }
158 };
159 
161 } // namespace interface1
162 
163 using interface1::BatchContainer;
164 using interface1::Batch;
165 
166 } // namespace prediction
167 } // namespace classification
168 } // namespace decision_tree
169 } // namespace algorithms
170 } // namespace daal
171 
172 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_tree_classification_predict.h:134
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::input
InputType input
Definition: decision_tree_classification_predict.h:97
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: decision_tree_classification_predict.h:121
daal::batch
Definition: daal_defines.h:110
daal::algorithms::decision_tree::classification::prediction::interface1::Batch
Provides methods to run implementations of the Decision tree model-based prediction.
Definition: decision_tree_classification_predict.h:88
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_tree_classification_predict.h:127
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_tree_classification_predict.h:112
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::Batch
Batch()
Definition: decision_tree_classification_predict.h:101
daal::algorithms::decision_tree::classification::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: decision_tree_classification_predict.h:98
daal::algorithms::decision_tree::classification::prediction::interface1::BatchContainer
Class containing computation methods for Decision tree model-based prediction.
Definition: decision_tree_classification_predict.h:54

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