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

decision_forest_regression_predict.h
1 /* file: decision_forest_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 forest model-based prediction
21 //--
22 */
23 
24 #ifndef __DECISION_FOREST_REGRESSION_PREDICT_H__
25 #define __DECISION_FOREST_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "algorithms/decision_forest/decision_forest_regression_predict_types.h"
29 #include "algorithms/regression/regression_predict.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace decision_forest
36 {
37 namespace regression
38 {
39 namespace prediction
40 {
41 namespace interface1
42 {
52 template<typename algorithmFPType, Method method, CpuType cpu>
53 class BatchContainer : public PredictionContainerIface
54 {
55 public:
60  BatchContainer(daal::services::Environment::env *daalEnv);
61  ~BatchContainer();
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_forest::regression::prediction::Input InputType;
92  typedef typename super::ParameterType ParameterType;
93  typedef algorithms::decision_forest::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) : input(other.input), parameter(other.parameter)
111  {
112  initialize();
113  }
114 
115  virtual InputType* getInput() DAAL_C11_OVERRIDE { return &input; }
116 
121  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
122 
127  ResultPtr getResult() { return ResultType::cast(_result); }
128 
134  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
135  {
136  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
137  }
138 
139 protected:
140 
141  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
142  {
143  return new Batch<algorithmFPType, method>(*this);
144  }
145 
146  services::Status allocateResult() DAAL_C11_OVERRIDE
147  {
148  services::Status s = getResult()->template allocate<algorithmFPType>(_in, 0, 0);
149  _res = _result.get();
150  return s;
151  }
152 
153  void initialize()
154  {
155  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
156  _in = &input;
157  _par = &parameter;
158  _result.reset(new ResultType());
159  }
160 };
162 } // namespace interface1
163 using interface1::BatchContainer;
164 using interface1::Batch;
165 
166 }
167 }
168 }
169 }
170 }
171 #endif
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_forest_regression_predict.h:110
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::input
InputType input
Definition: decision_forest_regression_predict.h:95
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: decision_forest_regression_predict.h:127
daal::batch
Definition: daal_defines.h:112
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_forest_regression_predict.h:134
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::Batch
Batch()
Definition: decision_forest_regression_predict.h:99
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: decision_forest_regression_predict.h:96
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_forest::regression::prediction::interface1::BatchContainer
Class containing computation methods for decision forest model-based prediction.
Definition: decision_forest_regression_predict.h:53
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:86
daal::algorithms::decision_forest::regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_forest_regression_predict.h:121
daal::algorithms::decision_forest::regression::prediction::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::decision_forest::regression::prediction::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)

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