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

svm_predict.h
1 /* file: svm_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 SVM model-based prediction
19 //--
20 */
21 
22 #ifndef __SVM_PREDICT_H__
23 #define __SVM_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "algorithms/classifier/classifier_predict.h"
28 #include "algorithms/svm/svm_predict_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace svm
35 {
36 namespace prediction
37 {
41 namespace interface1
42 {
57 template<typename algorithmFPType, Method method, CpuType cpu>
58 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
59 {
60 public:
65  BatchContainer(daal::services::Environment::env *daalEnv);
67  ~BatchContainer();
73  services::Status compute() DAAL_C11_OVERRIDE;
74 };
75 
93 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
94 class Batch : public classifier::prediction::Batch
95 {
96 public:
97  typedef classifier::prediction::Batch super;
98 
99  typedef algorithms::svm::prediction::Input InputType;
100  typedef algorithms::svm::Parameter ParameterType;
101  typedef typename super::ResultType ResultType;
102 
103  InputType input;
104  ParameterType parameter;
107  Batch()
108  {
109  initialize();
110  }
111 
118  Batch(const Batch<algorithmFPType, method> &other) : classifier::prediction::Batch(other),
119  input(other.input), parameter(other.parameter)
120  {
121  initialize();
122  }
123 
124  virtual ~Batch() {}
125 
130  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
131 
136  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
137 
138 
144  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
145  {
146  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
147  }
148 
149 protected:
150 
151  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
152  {
153  return new Batch<algorithmFPType, method>(*this);
154  }
155 
156  services::Status allocateResult() DAAL_C11_OVERRIDE
157  {
158  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
159  _res = _result.get();
160  return s;
161  }
162 
163  void initialize()
164  {
165  _in = &input;
166  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
167  _par = &parameter;
168  }
169 };
171 } // namespace interface1
172 using interface1::BatchContainer;
173 using interface1::Batch;
174 
175 } // namespace prediction
176 } // namespace svm
177 } // namespace algorithms
178 } // namespace daal
179 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::svm::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: svm_predict.h:130
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal::algorithms::svm::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: svm_predict.h:118
daal::batch
Definition: daal_defines.h:110
daal::algorithms::svm::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: svm_predict.h:104
daal::algorithms::svm::prediction::interface1::Batch::Batch
Batch()
Definition: svm_predict.h:107
daal::algorithms::svm::prediction::interface1::Batch
Algorithm class for making predictions based on the SVM model
Definition: svm_predict.h:94
daal::algorithms::svm::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: svm_predict.h:144
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::svm::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: svm_predict.h:136
daal::algorithms::svm::prediction::interface1::Batch::input
InputType input
Definition: svm_predict.h:103
daal::algorithms::svm::prediction::interface1::BatchContainer
Provides methods to run implementations of the SVM algorithm. It is associated with the Prediction cl...
Definition: svm_predict.h:58

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