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

stump_regression_predict.h
1 /* file: stump_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 stump model-based prediction
21 //--
22 */
23 
24 #ifndef __STUMP_REGRESSION_PREDICT_H__
25 #define __STUMP_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "algorithms/regression/regression_predict.h"
29 #include "algorithms/stump/stump_regression_predict_types.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace stump
36 {
37 namespace regression
38 {
47 namespace prediction
48 {
53 enum Method
54 {
55  defaultDense = 0
56 };
57 
61 namespace interface1
62 {
72 template<typename algorithmFPType, Method method, CpuType cpu>
73 class BatchContainer : public PredictionContainerIface
74 {
75 public:
80  BatchContainer(daal::services::Environment::env *daalEnv);
82  ~BatchContainer();
86  services::Status compute() DAAL_C11_OVERRIDE;
87 };
88 
109 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
110 class DAAL_EXPORT Batch : public daal::algorithms::regression::prediction::Batch
111 {
112 public:
113  typedef daal::algorithms::regression::prediction::Batch super;
114 
115  typedef algorithms::stump::regression::prediction::Input InputType;
116  typedef algorithms::stump::regression::Parameter ParameterType;
117  typedef algorithms::stump::regression::prediction::Result ResultType;
118 
119  InputType input;
121  Batch();
122 
129  Batch(const Batch<algorithmFPType, method> & other);
130 
131  virtual ~Batch()
132  {
133  delete _par;
134  }
135 
140  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
141 
146  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
147 
152  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
153 
158  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
159 
164  ResultPtr getResult() { return ResultType::cast(_result); }
165 
171  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
172  {
173  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
174  }
175 
176 protected:
177 
178  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
179  {
180  return new Batch<algorithmFPType, method>(*this);
181  }
182 
183  services::Status allocateResult() DAAL_C11_OVERRIDE
184  {
185  services::Status s = getResult()->template allocate<algorithmFPType>(_in, _par, (int)method);
186  _res = _result.get();
187  return s;
188  }
189 
190  void initialize()
191  {
192  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
193  _in = &input;
194  _result.reset(new ResultType());
195  }
196 };
197 }
198 using interface1::BatchContainer;
199 using interface1::Batch;
200 
201 } // namespace daal::algorithms::stump::regression::prediction
203 }
204 }
205 }
206 } // namespace daal
207 #endif
daal::algorithms::stump::regression::prediction::interface1::Batch
Predicts results of the decision stump regression.
Definition: stump_regression_predict.h:110
daal::batch
Definition: daal_defines.h:112
daal::algorithms::stump::regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: stump_regression_predict.h:158
daal::algorithms::stump::regression::prediction::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::stump::regression::prediction::interface1::BatchContainer
Provides methods to run implementations of the decision stump prediction algorithm. It is associated with the daal::algorithms::stump::regression::prediction::interface1::Batch class and supports methods to run based on the decision stump model.
Definition: stump_regression_predict.h:73
daal::algorithms::stump::regression::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: stump_regression_predict.h:152
daal::algorithms::stump::regression::prediction::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: stump_regression_predict.h:146
daal::algorithms::stump::regression::prediction::defaultDense
Definition: stump_regression_predict.h:55
daal::algorithms::stump::regression::prediction::interface1::Batch::parameter
ParameterType & parameter()
Definition: stump_regression_predict.h:140
daal::algorithms::stump::regression::prediction::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:42
daal::algorithms::stump::regression::prediction::interface1::Batch::input
InputType input
Definition: stump_regression_predict.h:119
daal::algorithms::stump::regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: stump_regression_predict.h:171
daal::algorithms::stump::regression::prediction::interface1::BatchContainer::~BatchContainer
~BatchContainer()
daal::algorithms::stump::regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: stump_regression_predict.h:164
daal::algorithms::stump::regression::prediction::Method
Method
Definition: stump_regression_predict.h:53

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