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

multi_class_classifier_predict.h
1 /* file: multi_class_classifier_predict.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 multi-class classifier model-based prediction
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __MULTI_CLASS_CLASSIFIER_PREDICT_H__
24 #define __MULTI_CLASS_CLASSIFIER_PREDICT_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/classifier/classifier_predict.h"
30 #include "algorithms/multi_class_classifier/multi_class_classifier_predict_types.h"
31 #include "algorithms/multi_class_classifier/multi_class_classifier_train_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace multi_class_classifier
38 {
42 namespace prediction
43 {
44 
48 namespace interface1
49 {
63 template<typename algorithmFPType, prediction::Method pmethod, training::Method tmethod, CpuType cpu>
64 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
65 {
66 public:
72  BatchContainer(daal::services::Environment::env *daalEnv);
74  ~BatchContainer();
80  services::Status compute() DAAL_C11_OVERRIDE;
81 };
82 
104 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, prediction::Method pmethod = defaultDense, training::Method tmethod = training::oneAgainstOne>
105 class Batch : public classifier::prediction::Batch
106 {
107 public:
108  typedef classifier::prediction::Batch super;
109 
110  typedef algorithms::multi_class_classifier::prediction::Input InputType;
111  typedef algorithms::multi_class_classifier::Parameter ParameterType;
112  typedef typename super::ResultType ResultType;
113 
114  InputType input;
115  ParameterType parameter;
121  DAAL_DEPRECATED Batch() : parameter(0)
122  {
123  initialize();
124  }
125 
130  Batch(size_t nClasses) : parameter(nClasses)
131  {
132  initialize();
133  }
134 
141  Batch(const Batch<algorithmFPType, pmethod, tmethod> &other) : classifier::prediction::Batch(other),
142  parameter(other.parameter), input(other.input)
143  {
144  initialize();
145  }
146 
147  virtual ~Batch() {}
148 
153  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
154 
159  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)pmethod; }
160 
166  services::SharedPtr<Batch<algorithmFPType, pmethod, tmethod> > clone() const
167  {
168  return services::SharedPtr<Batch<algorithmFPType, pmethod, tmethod> >(cloneImpl());
169  }
170 
171 protected:
172 
173  virtual Batch<algorithmFPType, pmethod, tmethod> * cloneImpl() const DAAL_C11_OVERRIDE
174  {
175  return new Batch<algorithmFPType, pmethod, tmethod>(*this);
176  }
177 
178  services::Status allocateResult() DAAL_C11_OVERRIDE
179  {
180  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, (int) pmethod);
181  _res = _result.get();
182  return s;
183  }
184 
185  void initialize()
186  {
187  _in = &input;
188  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, pmethod, tmethod)(&_env);
189  _par = &parameter;
190  }
191 };
193 } // namespace interface1
194 using interface1::BatchContainer;
195 using interface1::Batch;
196 
197 } // namespace prediction
198 } // namespace multi_class_classifier
199 } // namespace algorithms
200 } // namespace daal
201 #endif
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: multi_class_classifier_predict.h:115
daal
Definition: algorithm_base_common.h:31
daal::algorithms::multi_class_classifier::prediction::interface1::BatchContainer
Provides methods to run implementations of the multi-class classifier prediction algorithm.
Definition: multi_class_classifier_predict.h:64
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::input
InputType input
Definition: multi_class_classifier_predict.h:114
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal_defines.h
daal::batch
Definition: daal_defines.h:106
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: multi_class_classifier_predict.h:159
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: multi_class_classifier_predict.h:121
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, pmethod, tmethod > > clone() const
Definition: multi_class_classifier_predict.h:166
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::Batch
Batch(size_t nClasses)
Definition: multi_class_classifier_predict.h:130
daal::algorithms::multi_class_classifier::prediction::interface1::Batch
Provides methods to run implementations of the multi-class classifier prediction algorithm.
Definition: multi_class_classifier_predict.h:105
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: multi_class_classifier_predict.h:153
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, pmethod, tmethod > &other)
Definition: multi_class_classifier_predict.h:141

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