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

logitboost_predict.h
1 /* file: logitboost_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 LogitBoost model-based prediction
19 //--
20 */
21 
22 #ifndef __LOGIT_BOOST_PREDICT_H__
23 #define __LOGIT_BOOST_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/boosting/boosting_predict.h"
27 #include "algorithms/boosting/logitboost_model.h"
28 #include "algorithms/boosting/logitboost_predict_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace logitboost
35 {
39 namespace prediction
40 {
50 enum Method
51 {
52  defaultDense = 0
53 };
54 
58 namespace interface1
59 {
69 template<typename algorithmFPType, Method method, CpuType cpu>
70 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
71 {
72 public:
77  BatchContainer(daal::services::Environment::env *daalEnv);
79  ~BatchContainer();
83  services::Status compute() DAAL_C11_OVERRIDE;
84 };
85 
106 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
107 class Batch : public boosting::prediction::Batch
108 {
109 public:
110  typedef boosting::prediction::Batch super;
111 
112  typedef algorithms::logitboost::prediction::Input InputType;
113  typedef algorithms::logitboost::Parameter ParameterType;
114  typedef typename super::ResultType ResultType;
115 
116  InputType input;
117  ParameterType parameter;
123  Batch(size_t nClasses)
124  {
125  initialize();
126  parameter.nClasses = nClasses;
127  };
128 
135  Batch(const Batch<algorithmFPType, method> &other) : boosting::prediction::Batch(other),
136  input(other.input), parameter(other.parameter)
137  {
138  initialize();
139  }
140 
141  ~Batch() {}
142 
147  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
148 
153  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
154 
160  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
161  {
162  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
163  }
164 
165 protected:
166  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
167  {
168  return new Batch<algorithmFPType, method>(*this);
169  }
170 
171  services::Status allocateResult() DAAL_C11_OVERRIDE
172  {
173  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
174  _res = _result.get();
175  return s;
176  }
177 
178  void initialize()
179  {
180  _in = &input;
181  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
182  _par = &parameter;
183  }
184 };
186 } // namespace interface1
187 using interface1::BatchContainer;
188 using interface1::Batch;
189 
190 } // namespace daal::algorithms::logitboost::prediction
191 }
192 }
193 } // namespace daal
194 #endif
daal::algorithms::logitboost::prediction::Method
Method
Definition: logitboost_predict.h:50
daal
Definition: algorithm_base_common.h:31
daal::algorithms::logitboost::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: logitboost_predict.h:117
daal::algorithms::logitboost::prediction::interface1::Batch::input
InputType input
Definition: logitboost_predict.h:116
daal::algorithms::logitboost::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: logitboost_predict.h:160
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal::algorithms::logitboost::prediction::interface1::Batch::Batch
Batch(size_t nClasses)
Definition: logitboost_predict.h:123
daal::batch
Definition: daal_defines.h:110
daal::algorithms::logitboost::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: logitboost_predict.h:153
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::logitboost::prediction::interface1::BatchContainer
Provides methods to run implementations of the LogitBoost algorithm. This class is associated with da...
Definition: logitboost_predict.h:70
daal::algorithms::logitboost::prediction::interface1::Batch
Predicts LogitBoost classification results.
Definition: logitboost_predict.h:107
daal::algorithms::logitboost::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: logitboost_predict.h:135
daal::algorithms::logitboost::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: logitboost_predict.h:147
daal::algorithms::logitboost::prediction::defaultDense
Definition: logitboost_predict.h:52

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