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

stump_predict.h
1 /* file: stump_predict.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 decision stump model-based prediction
19 //--
20 */
21 
22 #ifndef __STUMP_PREDICT_H__
23 #define __STUMP_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/weak_learner/weak_learner_predict.h"
27 #include "algorithms/stump/stump_predict_types.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
33 namespace stump
34 {
43 namespace prediction
44 {
49 enum Method
50 {
51  defaultDense = 0
52 };
53 
57 namespace interface1
58 {
68 template<typename algorithmFPType, Method method, CpuType cpu>
69 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
70 {
71 public:
76  BatchContainer(daal::services::Environment::env *daalEnv);
78  ~BatchContainer();
82  services::Status compute() DAAL_C11_OVERRIDE;
83 };
84 
105 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
106 class Batch : public weak_learner::prediction::Batch
107 {
108 public:
109  typedef weak_learner::prediction::Batch super;
110 
111  typedef algorithms::stump::prediction::Input InputType;
112  typedef typename super::ParameterType ParameterType;
113  typedef typename super::ResultType ResultType;
114 
115  InputType input;
117  Batch()
118  {
119  initialize();
120  }
121 
128  Batch(const Batch<algorithmFPType, method> &other) : weak_learner::prediction::Batch(other), input(other.input)
129  {
130  initialize();
131  }
132 
133  ~Batch() {}
134 
139  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
140 
145  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
146 
152  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
153  {
154  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
155  }
156 
157 protected:
158  using weak_learner::prediction::Batch::_result;
159 
160  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
161  {
162  return new Batch<algorithmFPType, method>(*this);
163  }
164 
165  services::Status allocateResult() DAAL_C11_OVERRIDE
166  {
167  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
168  _res = _result.get();
169  return s;
170  }
171 
172  void initialize()
173  {
174  _in = &input;
175  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
176  _par = NULL;
177  }
178 };
179 } // namespace interface1
180 using interface1::BatchContainer;
181 using interface1::Batch;
182 
183 } // namespace daal::algorithms::stump::prediction
185 }
186 }
187 } // namespace daal
188 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::stump::prediction::interface1::BatchContainer
Provides methods to run implementations of the decision stump prediction algorithm. It is associated with the daal::algorithms::stump::prediction::interface1::Batch class and supports methods to run based on the decision stump model.
Definition: stump_predict.h:69
daal::algorithms::stump::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: stump_predict.h:145
daal::algorithms::stump::prediction::interface1::Batch
Predicts results of the decision stump classification.
Definition: stump_predict.h:106
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal::algorithms::stump::prediction::interface1::Batch::input
InputType input
Definition: stump_predict.h:115
daal::algorithms::stump::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: stump_predict.h:152
daal::algorithms::stump::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: stump_predict.h:128
daal::batch
Definition: daal_defines.h:110
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::stump::prediction::defaultDense
Definition: stump_predict.h:51
daal::algorithms::stump::prediction::Method
Method
Definition: stump_predict.h:49
daal::algorithms::stump::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: stump_predict.h:139

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