C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 3

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