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

brownboost_training_batch.h
1 /* file: brownboost_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 BrownBoost model-based training
19 //--
20 */
21 
22 #ifndef __BROWN_BOOST_TRAINING_BATCH_H__
23 #define __BROWN_BOOST_TRAINING_BATCH_H__
24 
25 #include "algorithms/boosting/boosting_training_batch.h"
26 #include "algorithms/boosting/brownboost_training_types.h"
27 
28 namespace daal
29 {
30 namespace algorithms
31 {
32 namespace brownboost
33 {
34 namespace training
35 {
36 
37 namespace interface1
38 {
52 template<typename algorithmFPType, Method method, CpuType cpu>
53 class DAAL_EXPORT BatchContainer : public TrainingContainerIface<batch>
54 {
55 public:
61  BatchContainer(daal::services::Environment::env *daalEnv);
63  ~BatchContainer();
67  services::Status compute() DAAL_C11_OVERRIDE;
68 };
69 
87 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
88 class DAAL_EXPORT Batch : public boosting::training::Batch
89 {
90 public:
91  typedef boosting::training::Batch super;
92 
93  typedef typename super::InputType InputType;
94  typedef algorithms::brownboost::Parameter ParameterType;
95  typedef algorithms::brownboost::training::Result ResultType;
96 
97  ParameterType parameter;
98  InputType input;
100  Batch()
101  {
102  initialize();
103  }
104 
111  Batch(const Batch<algorithmFPType, method> &other) : boosting::training::Batch(other),
112  parameter(other.parameter), input(other.input)
113  {
114  initialize();
115  }
116 
117  virtual ~Batch() {}
118 
123  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
124 
129  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
130 
135  ResultPtr getResult()
136  {
137  return ResultType::cast(_result);
138  }
139 
143  services::Status resetResult() DAAL_C11_OVERRIDE
144  {
145  _result.reset(new ResultType());
146  DAAL_CHECK(_result, services::ErrorNullResult);
147  _res = NULL;
148  return services::Status();
149  }
150 
156  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
157  {
158  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
159  }
160 
161 protected:
162  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
163  {
164  return new Batch<algorithmFPType, method>(*this);
165  }
166 
167  services::Status allocateResult() DAAL_C11_OVERRIDE
168  {
169  ResultPtr res = getResult();
170  DAAL_CHECK(_result, services::ErrorNullResult);
171  services::Status s = res->template allocate<algorithmFPType>(&input, _par, method);
172  _res = _result.get();
173  return s;
174  }
175 
176  void initialize()
177  {
178  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
179  _in = &input;
180  _par = &parameter;
181  _result.reset(new ResultType());
182  }
183 };
185 } // namespace interface1
186 using interface1::BatchContainer;
187 using interface1::Batch;
188 
189 } // namespace daal::algorithms::brownboost::training
190 }
191 }
192 } // namespace daal
193 #endif // __BROWN_BOOST_TRAINING_BATCH_H__
daal::algorithms::brownboost::training::interface1::Batch
Trains model of the BrownBoost algorithms in the batch processing mode.
Definition: brownboost_training_batch.h:88
daal
Definition: algorithm_base_common.h:31
daal::algorithms::brownboost::training::interface1::Batch::input
InputType input
Definition: brownboost_training_batch.h:98
daal::algorithms::brownboost::training::interface1::Batch::parameter
ParameterType parameter
Definition: brownboost_training_batch.h:97
daal::algorithms::brownboost::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: brownboost_training_batch.h:129
daal::algorithms::brownboost::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: brownboost_training_batch.h:111
daal::batch
Definition: daal_defines.h:110
daal::algorithms::brownboost::training::interface1::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: brownboost_training_batch.h:143
daal::algorithms::brownboost::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: brownboost_training_batch.h:135
daal::algorithms::brownboost::training::interface1::BatchContainer
Provides methods to run implementations of BrownBoost model-based training. This class is associated ...
Definition: brownboost_training_batch.h:53
daal::algorithms::brownboost::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: brownboost_training_batch.h:156
daal::algorithms::brownboost::training::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: brownboost_training_batch.h:123
daal::services::ErrorNullResult
Definition: error_indexes.h:96
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.