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

gbt_regression_predict.h
1 /* file: gbt_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 model-based prediction
19 //--
20 */
21 
22 #ifndef __GBT_REGRESSION_PREDICT_H__
23 #define __GBT_REGRESSION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/gradient_boosted_trees/gbt_regression_predict_types.h"
27 #include "algorithms/regression/regression_predict.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
33 namespace gbt
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 DAAL_EXPORT Batch : public algorithms::regression::prediction::Batch
85 {
86 public:
87  typedef algorithms::gbt::regression::prediction::Input InputType;
88  typedef algorithms::gbt::regression::prediction::Parameter ParameterType;
89  typedef algorithms::gbt::regression::prediction::Result ResultType;
90 
91  InputType input;
94  Batch();
95 
102  Batch(const Batch<algorithmFPType, method> &other);
103 
105  ~Batch()
106  {
107  delete _par;
108  }
109 
114  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
115 
120  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
121 
126  virtual algorithms::regression::prediction::Input* getInput() DAAL_C11_OVERRIDE{ return &input; }
127 
132  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
133 
138  ResultPtr getResult() { return ResultType::cast(_result); }
139 
145  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
146  {
147  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
148  }
149 
150 protected:
151 
152  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
153  {
154  return new Batch<algorithmFPType, method>(*this);
155  }
156 
157  services::Status allocateResult() DAAL_C11_OVERRIDE
158  {
159  services::Status s = getResult()->template allocate<algorithmFPType>(_in, 0, 0);
160  _res = _result.get();
161  return s;
162  }
163 
164  void initialize()
165  {
166  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
167  _in = &input;
168  _result.reset(new ResultType());
169  }
170 };
172 } // namespace interface1
173 using interface1::BatchContainer;
174 using interface1::Batch;
175 
176 }
177 }
178 }
179 }
180 }
181 #endif
daal::algorithms::gbt::regression::prediction::interface1::Batch::input
InputType input
Definition: gbt_regression_predict.h:91
daal
Definition: algorithm_base_common.h:31
daal::algorithms::gbt::regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: gbt_regression_predict.h:138
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal::algorithms::gbt::regression::prediction::interface1::Batch::parameter
ParameterType & parameter()
Definition: gbt_regression_predict.h:114
daal::algorithms::gbt::regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: gbt_regression_predict.h:132
daal::algorithms::gbt::regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: gbt_regression_predict.h:145
daal::batch
Definition: daal_defines.h:110
daal::algorithms::gbt::regression::prediction::interface1::Batch::getInput
virtual algorithms::regression::prediction::Input * getInput() DAAL_C11_OVERRIDE
Definition: gbt_regression_predict.h:126
daal::algorithms::gbt::regression::prediction::interface1::Batch::~Batch
~Batch()
Definition: gbt_regression_predict.h:105
daal::algorithms::gbt::regression::prediction::interface1::Batch
Provides methods to run implementations of the model-based prediction.
Definition: gbt_regression_predict.h:84
daal::algorithms::gbt::regression::prediction::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: gbt_regression_predict.h:120
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::gbt::regression::prediction::interface1::BatchContainer
Class containing computation methods for model-based prediction.
Definition: gbt_regression_predict.h:51

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