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

decision_tree_regression_predict.h
1 /* file: decision_tree_regression_predict.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the interface for Decision tree regression model-based prediction
21 //--
22 */
23 
24 #ifndef __DECISION_TREE_REGRESSION_PREDICT_H__
25 #define __DECISION_TREE_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "algorithms/decision_tree/decision_tree_regression_predict_types.h"
29 #include "algorithms/regression/regression_predict.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace decision_tree
36 {
37 namespace regression
38 {
39 namespace prediction
40 {
41 namespace interface1
42 {
53 template<typename algorithmFPType, Method method, CpuType cpu>
54 class BatchContainer : public PredictionContainerIface
55 {
56 public:
61  DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
62 
63  DAAL_DEPRECATED ~BatchContainer();
64 
68  DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE;
69 };
70 
87 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
88 class Batch : public algorithms::regression::prediction::Batch
89 {
90 public:
91  typedef algorithms::regression::prediction::Batch super;
92 
93  typedef algorithms::decision_tree::regression::prediction::Input InputType;
94  typedef algorithms::decision_tree::regression::Parameter ParameterType;
95  typedef algorithms::decision_tree::regression::prediction::Result ResultType;
96 
97  InputType input;
98  ParameterType parameter;
101  DAAL_DEPRECATED Batch()
102  {
103  initialize();
104  }
105 
112  DAAL_DEPRECATED Batch(const Batch<algorithmFPType, method> & other) :
113  algorithms::regression::prediction::Batch(other), input(other.input), parameter(other.parameter)
114  {
115  initialize();
116  }
117 
118  DAAL_DEPRECATED_VIRTUAL virtual algorithms::regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
119 
124  DAAL_DEPRECATED_VIRTUAL virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
125 
130  DAAL_DEPRECATED ResultPtr getResult() { return ResultType::cast(_result); }
131 
137  DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone() const
138  {
139  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
140  }
141 
142 protected:
143  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
144  {
145  return new Batch<algorithmFPType, method>(*this);
146  }
147 
148  services::Status allocateResult() DAAL_C11_OVERRIDE
149  {
150  services::Status s = getResult()->template allocate<algorithmFPType>(_in, &parameter, (int)method);
151  _res = _result.get();
152  return s;
153  }
154 
155  void initialize()
156  {
157  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
158  _in = &input;
159  _par = &parameter;
160  _result.reset(new ResultType());
161  }
162 };
164 } // namespace interface1
165 
166 namespace interface2
167 {
178 template<typename algorithmFPType, Method method, CpuType cpu>
179 class BatchContainer : public PredictionContainerIface
180 {
181 public:
186  BatchContainer(daal::services::Environment::env *daalEnv);
187 
188  ~BatchContainer();
189 
193  services::Status compute() DAAL_C11_OVERRIDE;
194 };
195 
212 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
213 class Batch : public algorithms::regression::prediction::Batch
214 {
215 public:
216  typedef algorithms::regression::prediction::Batch super;
217 
218  typedef algorithms::decision_tree::regression::prediction::Input InputType;
219  typedef algorithms::decision_tree::regression::Parameter ParameterType;
220  typedef algorithms::decision_tree::regression::prediction::Result ResultType;
221 
222  InputType input;
223  ParameterType parameter;
226  Batch()
227  {
228  initialize();
229  }
230 
237  Batch(const Batch<algorithmFPType, method> & other) :
238  algorithms::regression::prediction::Batch(other), input(other.input), parameter(other.parameter)
239  {
240  initialize();
241  }
242 
243  virtual algorithms::regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
244 
249  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
250 
255  ResultPtr getResult() { return ResultType::cast(_result); }
256 
262  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
263  {
264  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
265  }
266 
267 protected:
268  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
269  {
270  return new Batch<algorithmFPType, method>(*this);
271  }
272 
273  services::Status allocateResult() DAAL_C11_OVERRIDE
274  {
275  services::Status s = getResult()->template allocate<algorithmFPType>(_in, &parameter, (int)method);
276  _res = _result.get();
277  return s;
278  }
279 
280  void initialize()
281  {
282  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
283  _in = &input;
284  _par = &parameter;
285  _result.reset(new ResultType());
286  }
287 };
289 }
290 
291 using interface2::BatchContainer;
292 using interface2::Batch;
293 
294 
295 } // namespace prediction
296 } // namespace regression
297 } // namespace decision_tree
298 } // namespace algorithms
299 } // namespace daal
300 
301 #endif
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: decision_tree_regression_predict.h:101
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::input
InputType input
Definition: decision_tree_regression_predict.h:97
daal::batch
Definition: daal_defines.h:112
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::Batch
DAAL_DEPRECATED Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_tree_regression_predict.h:112
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::input
InputType input
Definition: decision_tree_regression_predict.h:222
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::Batch
Batch()
Definition: decision_tree_regression_predict.h:226
daal::algorithms::decision_tree::regression::prediction::interface1::BatchContainer::compute
DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_tree_regression_predict.h:137
daal::algorithms::decision_tree::regression::prediction::interface2::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_tree_regression_predict.h:249
daal::algorithms::decision_tree::regression::prediction::interface1::Batch
Provides methods to run implementations of the Decision tree model-based prediction.
Definition: decision_tree_regression_predict.h:88
daal::algorithms::decision_tree::regression::prediction::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_tree_regression_predict.h:124
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:42
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_tree_regression_predict.h:262
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::getResult
ResultPtr getResult()
Definition: decision_tree_regression_predict.h:255
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_tree_regression_predict.h:237
daal::algorithms::decision_tree::regression::prediction::interface2::Batch::parameter
ParameterType parameter
Definition: decision_tree_regression_predict.h:223
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: decision_tree_regression_predict.h:98
daal::algorithms::decision_tree::regression::prediction::interface1::BatchContainer
Class containing computation methods for Decision tree model-based prediction.
Definition: decision_tree_regression_predict.h:54
daal::algorithms::decision_tree::regression::prediction::prediction
Definition: decision_tree_regression_predict_types.h:96
daal::algorithms::decision_tree::regression::prediction::interface2::Batch
Provides methods to run implementations of the Decision tree model-based prediction.
Definition: decision_tree_regression_predict.h:213
daal::algorithms::decision_tree::regression::prediction::interface2::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::decision_tree::regression::prediction::interface2::BatchContainer
Class containing computation methods for Decision tree model-based prediction.
Definition: decision_tree_regression_predict.h:179
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::getResult
DAAL_DEPRECATED ResultPtr getResult()
Definition: decision_tree_regression_predict.h:130

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