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

gbt_regression_predict.h
1 /* file: gbt_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 model-based prediction
21 //--
22 */
23 
24 #ifndef __GBT_REGRESSION_PREDICT_H__
25 #define __GBT_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "algorithms/gradient_boosted_trees/gbt_regression_predict_types.h"
29 #include "algorithms/regression/regression_predict.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 namespace gbt
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 DAAL_EXPORT Batch : public algorithms::regression::prediction::Batch
87 {
88 public:
89  typedef algorithms::gbt::regression::prediction::Input InputType;
90  typedef algorithms::gbt::regression::prediction::Parameter ParameterType;
91  typedef algorithms::gbt::regression::prediction::Result ResultType;
92 
93  InputType input;
96  Batch();
97 
104  Batch(const Batch<algorithmFPType, method> &other);
105 
107  ~Batch()
108  {
109  delete _par;
110  }
111 
116  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
117 
122  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
123 
128  virtual algorithms::regression::prediction::Input* getInput() DAAL_C11_OVERRIDE{ return &input; }
129 
134  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
135 
140  ResultPtr getResult() { return ResultType::cast(_result); }
141 
147  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
148  {
149  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
150  }
151 
152 protected:
153 
154  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
155  {
156  return new Batch<algorithmFPType, method>(*this);
157  }
158 
159  services::Status allocateResult() DAAL_C11_OVERRIDE
160  {
161  services::Status s = getResult()->template allocate<algorithmFPType>(_in, _par, 0);
162  _res = _result.get();
163  return s;
164  }
165 
166  void initialize()
167  {
168  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
169  _in = &input;
170  _result.reset(new ResultType());
171  }
172 };
174 } // namespace interface1
175 using interface1::BatchContainer;
176 using interface1::Batch;
177 
178 }
179 }
180 }
181 }
182 }
183 #endif
daal::algorithms::gbt::regression::prediction::interface1::Batch::~Batch
~Batch()
Definition: gbt_regression_predict.h:107
daal::algorithms::gbt::regression::prediction::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: gbt_regression_predict.h:122
daal::batch
Definition: daal_defines.h:112
daal::algorithms::gbt::regression::prediction::interface1::BatchContainer
Class containing computation methods for model-based prediction.
Definition: gbt_regression_predict.h:53
daal::algorithms::gbt::regression::prediction::interface1::Batch::getInput
virtual algorithms::regression::prediction::Input * getInput() DAAL_C11_OVERRIDE
Definition: gbt_regression_predict.h:128
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::gbt::regression::prediction::interface1::Batch
Provides methods to run implementations of the model-based prediction.
Definition: gbt_regression_predict.h:86
daal::algorithms::gbt::regression::prediction::interface1::Batch::parameter
ParameterType & parameter()
Definition: gbt_regression_predict.h:116
daal::algorithms::gbt::regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: gbt_regression_predict.h:134
daal::algorithms::gbt::regression::prediction::interface1::Batch::input
InputType input
Definition: gbt_regression_predict.h:93
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:42
daal::algorithms::gbt::regression::prediction::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::gbt::regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: gbt_regression_predict.h:147
daal::algorithms::gbt::regression::prediction::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::gbt::regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: gbt_regression_predict.h:140

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