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

decision_forest_regression_predict.h
1 /* file: decision_forest_regression_predict.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 forest model-based prediction
19 //--
20 */
21 
22 #ifndef __DECISION_FOREST_REGRESSION_PREDICT_H__
23 #define __DECISION_FOREST_REGRESSION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/decision_forest/decision_forest_regression_predict_types.h"
27 #include "algorithms/regression/regression_predict.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
33 namespace decision_forest
34 {
35 namespace regression
36 {
37 namespace prediction
38 {
39 namespace interface1
40 {
50 template<typename algorithmFPType, Method method, CpuType cpu>
51 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
52 {
53 public:
58  BatchContainer(daal::services::Environment::env *daalEnv);
59  ~BatchContainer();
64  services::Status compute() DAAL_C11_OVERRIDE;
65 };
66 
83 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
84 class Batch : public algorithms::regression::prediction::Batch
85 {
86 public:
87  typedef algorithms::regression::prediction::Batch super;
88 
89  typedef algorithms::decision_forest::regression::prediction::Input InputType;
90  typedef typename super::ParameterType ParameterType;
91  typedef algorithms::decision_forest::regression::prediction::Result ResultType;
92 
93  InputType input;
94  ParameterType parameter;
97  Batch()
98  {
99  initialize();
100  }
101 
108  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
109  {
110  initialize();
111  }
112 
113  virtual InputType* getInput() DAAL_C11_OVERRIDE { return &input; }
114 
119  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
120 
125  ResultPtr getResult() { return ResultType::cast(_result); }
126 
132  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
133  {
134  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
135  }
136 
137 protected:
138 
139  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
140  {
141  return new Batch<algorithmFPType, method>(*this);
142  }
143 
144  services::Status allocateResult() DAAL_C11_OVERRIDE
145  {
146  services::Status s = getResult()->template allocate<algorithmFPType>(_in, 0, 0);
147  _res = _result.get();
148  return s;
149  }
150 
151  void initialize()
152  {
153  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
154  _in = &input;
155  _par = &parameter;
156  _result.reset(new ResultType());
157  }
158 };
160 } // namespace interface1
161 using interface1::BatchContainer;
162 using interface1::Batch;
163 
164 }
165 }
166 }
167 }
168 }
169 #endif
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_forest_regression_predict.h:132
daal
Definition: algorithm_base_common.h:31
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_forest::regression::prediction::interface1::BatchContainer
Class containing computation methods for decision forest model-based prediction.
Definition: decision_forest_regression_predict.h:51
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::input
InputType input
Definition: decision_forest_regression_predict.h:93
daal::batch
Definition: daal_defines.h:106
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_forest_regression_predict.h:119
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::Batch
Batch()
Definition: decision_forest_regression_predict.h:97
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_forest_regression_predict.h:108
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: decision_forest_regression_predict.h:94
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::decision_forest::regression::prediction::interface1::Batch
Provides methods to run implementations of the decision forest model-based prediction.
Definition: decision_forest_regression_predict.h:84
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: decision_forest_regression_predict.h:125

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