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

gbt_classification_predict.h
1 /* file: gbt_classification_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 gradient boosted trees classification model-based prediction
19 //--
20 */
21 
22 #ifndef __GBT_CLASSIFICATION_PREDICT_H__
23 #define __GBT_CLASSIFICATION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/classifier/classifier_predict.h"
27 #include "algorithms/gradient_boosted_trees/gbt_classification_model.h"
28 #include "algorithms/gradient_boosted_trees/gbt_classification_predict_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace gbt
35 {
36 namespace classification
37 {
41 namespace prediction
42 {
52 namespace interface1
53 {
63 template<typename algorithmFPType, Method method, CpuType cpu>
64 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
65 {
66 public:
71  BatchContainer(daal::services::Environment::env *daalEnv);
73  ~BatchContainer();
78  services::Status compute() DAAL_C11_OVERRIDE;
79 };
80 
101 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
102 class DAAL_EXPORT Batch : public classifier::prediction::Batch
103 {
104 public:
105  typedef classifier::prediction::Batch super;
106 
107  typedef algorithms::gbt::classification::prediction::Input InputType;
108  typedef algorithms::gbt::classification::prediction::Parameter ParameterType;
109  typedef typename super::ResultType ResultType;
110 
111  InputType input;
117  Batch(size_t nClasses);
118 
125  Batch(const Batch<algorithmFPType, method> &other);
126 
128  ~Batch()
129  {
130  delete _par;
131  }
132 
137  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
138 
143  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
144 
149  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
150 
155  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
156 
162  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
163  {
164  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
165  }
166 
167 protected:
168  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
169  {
170  return new Batch<algorithmFPType, method>(*this);
171  }
172 
173  services::Status allocateResult() DAAL_C11_OVERRIDE
174  {
175  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
176  _res = _result.get();
177  return s;
178  }
179 
180  void initialize()
181  {
182  _in = &input;
183  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
184  }
185 };
187 } // namespace interface1
188 using interface1::BatchContainer;
189 using interface1::Batch;
190 
191 } // namespace daal::algorithms::gbt::classification::prediction
192 }
193 }
194 }
195 } // namespace daal
196 #endif
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::gbt::classification::prediction::interface1::Batch::~Batch
~Batch()
Definition: gbt_classification_predict.h:128
daal::batch
Definition: daal_defines.h:106
daal::algorithms::gbt::classification::prediction::interface1::Batch::parameter
ParameterType & parameter()
Definition: gbt_classification_predict.h:137
daal::algorithms::gbt::classification::prediction::interface1::BatchContainer
Provides methods to run implementations of the gradient boosted trees algorithm. This class is associ...
Definition: gbt_classification_predict.h:64
daal::algorithms::gbt::classification::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: gbt_classification_predict.h:162
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::gbt::classification::prediction::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: gbt_classification_predict.h:143
daal::algorithms::gbt::classification::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: gbt_classification_predict.h:149
daal::algorithms::gbt::classification::prediction::interface1::Batch::input
InputType input
Definition: gbt_classification_predict.h:111
daal::algorithms::gbt::classification::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: gbt_classification_predict.h:155
daal::algorithms::gbt::classification::prediction::interface1::Batch
Predicts gradient boosted trees classification results.
Definition: gbt_classification_predict.h:102

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