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

gbt_regression_training_batch.h
1 /* file: gbt_regression_training_batch.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 training
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __GBT_REGRESSSION_TRAINING_BATCH_H__
24 #define __GBT_REGRESSSION_TRAINING_BATCH_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "services/daal_memory.h"
30 #include "algorithms/gradient_boosted_trees/gbt_regression_training_types.h"
31 #include "algorithms/gradient_boosted_trees/gbt_regression_model.h"
32 #include "algorithms/regression/regression_training_batch.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
38 namespace gbt
39 {
40 namespace regression
41 {
42 namespace training
43 {
44 namespace interface1
45 {
56 template<typename algorithmFPType, Method method, CpuType cpu>
57 class DAAL_EXPORT BatchContainer : public TrainingContainerIface<batch>
58 {
59 public:
65  BatchContainer(daal::services::Environment::env *daalEnv);
67  ~BatchContainer();
72  services::Status compute() DAAL_C11_OVERRIDE;
73  services::Status setupCompute() DAAL_C11_OVERRIDE;
74 };
75 
91 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
92 class DAAL_EXPORT Batch : public algorithms::regression::training::Batch
93 {
94 public:
95  typedef algorithms::gbt::regression::training::Input InputType;
96  typedef algorithms::gbt::regression::training::Parameter ParameterType;
97  typedef algorithms::gbt::regression::training::Result ResultType;
98 
99  InputType input;
102  Batch();
103 
110  Batch(const Batch<algorithmFPType, method> &other);
111 
113  ~Batch()
114  {
115  delete _par;
116  }
117 
122  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
123 
128  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
129 
134  virtual algorithms::regression::training::Input* getInput() DAAL_C11_OVERRIDE{ return &input; }
135 
140  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
141 
146  ResultPtr getResult() { return ResultType::cast(_result); }
147 
154  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
155  {
156  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
157  }
158 
159 protected:
160 
161  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
162  {
163  return new Batch<algorithmFPType, method>(*this);
164  }
165 
166  services::Status allocateResult() DAAL_C11_OVERRIDE
167  {
168  services::Status s = getResult()->template allocate<algorithmFPType>(&input, &parameter(), method);
169  _res = _result.get();
170  return s;
171  }
172 
173  void initialize()
174  {
175  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
176  _in = &input;
177  _result.reset(new ResultType());
178  }
179 };
181 } // namespace interface1
182 using interface1::BatchContainer;
183 using interface1::Batch;
184 }
185 }
186 }
187 }
188 }
189 #endif
daal::algorithms::gbt::regression::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: gbt_regression_training_batch.h:146
daal::algorithms::gbt::regression::training::interface1::Batch::~Batch
~Batch()
Definition: gbt_regression_training_batch.h:113
daal
Definition: algorithm_base_common.h:31
daal::algorithms::gbt::regression::training::interface1::Batch::getInput
virtual algorithms::regression::training::Input * getInput() DAAL_C11_OVERRIDE
Definition: gbt_regression_training_batch.h:134
daal_defines.h
daal::algorithms::gbt::regression::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: gbt_regression_training_batch.h:154
daal::algorithms::gbt::regression::training::interface1::BatchContainer
Class containing methods for gradient boosted trees regression model-based training using algorithmFP...
Definition: gbt_regression_training_batch.h:57
daal::batch
Definition: daal_defines.h:110
daal::algorithms::gbt::regression::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: gbt_regression_training_batch.h:140
daal::algorithms::gbt::regression::training::interface1::Batch::input
InputType input
Definition: gbt_regression_training_batch.h:99
daal::algorithms::gbt::regression::training::interface1::Batch::parameter
ParameterType & parameter()
Definition: gbt_regression_training_batch.h:122
daal::algorithms::gbt::regression::training::interface1::Batch
Provides methods for model-based training in the batch processing mode.
Definition: gbt_regression_training_batch.h:92
daal::algorithms::gbt::regression::training::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: gbt_regression_training_batch.h:128
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:50

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