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

decision_tree_regression_predict.h
1 /* file: decision_tree_regression_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 regression model-based prediction
19 //--
20 */
21 
22 #ifndef __DECISION_TREE_REGRESSION_PREDICT_H__
23 #define __DECISION_TREE_REGRESSION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/decision_tree/decision_tree_regression_predict_types.h"
27 #include "algorithms/regression/regression_predict.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
33 namespace decision_tree
34 {
35 namespace regression
36 {
37 namespace prediction
38 {
39 namespace interface1
40 {
51 template<typename algorithmFPType, Method method, CpuType cpu>
52 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
53 {
54 public:
59  BatchContainer(daal::services::Environment::env *daalEnv);
60 
61  ~BatchContainer();
62 
66  services::Status compute() DAAL_C11_OVERRIDE;
67 };
68 
85 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
86 class Batch : public algorithms::regression::prediction::Batch
87 {
88 public:
89  typedef algorithms::regression::prediction::Batch super;
90 
91  typedef algorithms::decision_tree::regression::prediction::Input InputType;
92  typedef algorithms::decision_tree::regression::Parameter ParameterType;
93  typedef algorithms::decision_tree::regression::prediction::Result ResultType;
94 
95  InputType input;
96  ParameterType parameter;
99  Batch()
100  {
101  initialize();
102  }
103 
110  Batch(const Batch<algorithmFPType, method> & other) :
111  algorithms::regression::prediction::Batch(other), input(other.input), parameter(other.parameter)
112  {
113  initialize();
114  }
115 
116  virtual algorithms::regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
117 
122  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
123 
128  ResultPtr getResult() { return ResultType::cast(_result); }
129 
135  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
136  {
137  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
138  }
139 
140 protected:
141 
142  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
143  {
144  return new Batch<algorithmFPType, method>(*this);
145  }
146 
147  services::Status allocateResult() DAAL_C11_OVERRIDE
148  {
149  services::Status s = getResult()->template allocate<algorithmFPType>(_in, &parameter, (int)method);
150  _res = _result.get();
151  return s;
152  }
153 
154  void initialize()
155  {
156  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
157  _in = &input;
158  _par = &parameter;
159  _result.reset(new ResultType());
160  }
161 };
163 } // namespace interface1
164 
165 using interface1::BatchContainer;
166 using interface1::Batch;
167 
168 } // namespace prediction
169 } // namespace regression
170 } // namespace decision_tree
171 } // namespace algorithms
172 } // namespace daal
173 
174 #endif
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: decision_tree_regression_predict.h:128
daal::algorithms::decision_tree::regression::prediction::prediction
Definition: decision_tree_regression_predict_types.h:94
daal
Definition: algorithm_base_common.h:31
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::Batch
Batch()
Definition: decision_tree_regression_predict.h:99
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::regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_tree_regression_predict.h:122
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: decision_tree_regression_predict.h:96
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::input
InputType input
Definition: decision_tree_regression_predict.h:95
daal::batch
Definition: daal_defines.h:110
daal::algorithms::decision_tree::regression::prediction::interface1::BatchContainer
Class containing computation methods for Decision tree model-based prediction.
Definition: decision_tree_regression_predict.h:52
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:86
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_tree_regression_predict.h:135
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::decision_tree::regression::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_tree_regression_predict.h:110

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