C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

classifier_predict_types.h
1 /* file: classifier_predict_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the base classes used in the prediction stage
21 // of the classifier algorithm
22 //--
23 */
24 
25 #ifndef __CLASSIFIER_PREDICT_TYPES_H__
26 #define __CLASSIFIER_PREDICT_TYPES_H__
27 
28 #include "algorithms/algorithm.h"
29 #include "algorithms/classifier/classifier_model.h"
30 
31 #include "data_management/data/homogen_numeric_table.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace classifier
38 {
48 namespace prediction
49 {
55 enum NumericTableInputId
56 {
57  data,
58  lastNumericTableInputId = data
59 };
60 
66 enum ModelInputId
67 {
68  model = lastNumericTableInputId + 1,
69  lastModelInputId = model
70 };
71 
76 enum ResultId
77 {
78  prediction,
79  probabilities,
80  logProbabilities,
81  lastResultId = logProbabilities
82 };
83 
87 namespace interface1
88 {
93 class DAAL_EXPORT InputIface : public daal::algorithms::Input
94 {
95 public:
96  InputIface(size_t nElements);
97  InputIface(const InputIface& other) : daal::algorithms::Input(other){}
98 
99  virtual ~InputIface() {}
104  virtual size_t getNumberOfRows() const = 0;
105 };
106 
111 class DAAL_EXPORT Input : public InputIface
112 {
113 public:
114  Input();
115  Input(const Input& other) : InputIface(other){}
116  virtual ~Input() {}
117 
122  size_t getNumberOfRows() const DAAL_C11_OVERRIDE;
123 
129  data_management::NumericTablePtr get(NumericTableInputId id) const;
130 
136  classifier::ModelPtr get(ModelInputId id) const;
137 
143  void set(NumericTableInputId id, const data_management::NumericTablePtr &ptr);
144 
150  void set(ModelInputId id, const ModelPtr &ptr);
151 
157  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
158 
159 protected:
160  services::Status checkImpl(const daal::algorithms::Parameter *parameter) const;
161 };
162 
168 class DAAL_EXPORT Result : public daal::algorithms::Result
169 {
170 public:
171  DECLARE_SERIALIZABLE_CAST(Result);
172  Result();
173 
179  DAAL_DEPRECATED data_management::NumericTablePtr get(ResultId id) const;
180 
186  DAAL_DEPRECATED void set(ResultId id, const data_management::NumericTablePtr &value);
187 
195  template <typename algorithmFPType>
196  DAAL_EXPORT DAAL_DEPRECATED services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
197 
205  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter,
206  int method) const DAAL_C11_OVERRIDE;
207 
208 protected:
209  Result(size_t n);
210  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
211 
213  template<typename Archive, bool onDeserialize>
214  services::Status serialImpl(Archive *arch)
215  {
216  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
217  }
218 };
219 typedef services::SharedPtr<Result> ResultPtr;
220 } // namespace interface1
221 
225 namespace interface2
226 {
232 class DAAL_EXPORT Result : public daal::algorithms::Result
233 {
234 public:
235  DECLARE_SERIALIZABLE_CAST(Result);
236  Result();
237  virtual ~Result() {}
238 
244  data_management::NumericTablePtr get(ResultId id) const;
245 
251  void set(ResultId id, const data_management::NumericTablePtr &value);
252 
260  template <typename algorithmFPType>
261  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
262 
269  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter,
270  int method) const DAAL_C11_OVERRIDE;
271 
272 protected:
273  Result(const size_t n);
274  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
275 
277  template<typename Archive, bool onDeserialize>
278  services::Status serialImpl(Archive *arch)
279  {
280  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
281  }
282 };
283 typedef services::SharedPtr<Result> ResultPtr;
284 } // namespace interface2
285 using interface1::InputIface;
286 using interface1::Input;
287 using interface2::Result;
288 using interface2::ResultPtr;
289 }
291 }
292 }
293 }
294 #endif
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:78
daal::algorithms::classifier::prediction::logProbabilities
Definition: classifier_predict_types.h:80
daal::algorithms::classifier::prediction::probabilities
Definition: classifier_predict_types.h:79
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::classifier::prediction::interface1::Input
Input objects in the prediction stage of the classification algorithm.
Definition: classifier_predict_types.h:111
daal::algorithms::classifier::prediction::NumericTableInputId
NumericTableInputId
Definition: classifier_predict_types.h:55
daal::algorithms::classifier::prediction::ResultId
ResultId
Definition: classifier_predict_types.h:76
daal::algorithms::classifier::prediction::interface1::Result
Provides methods to access prediction results obtained with the compute() method of the classifier pr...
Definition: classifier_predict_types.h:168
daal::algorithms::classifier::prediction::ModelInputId
ModelInputId
Definition: classifier_predict_types.h:66
daal::algorithms::classifier::prediction::interface2::Result
Provides methods to access prediction results obtained with the compute() method of the classifier pr...
Definition: classifier_predict_types.h:232
daal::algorithms::classifier::prediction::interface1::InputIface
Base class for working with input objects in the prediction stage of the classification algorithm...
Definition: classifier_predict_types.h:93
daal::algorithms::classifier::prediction::data
Definition: classifier_predict_types.h:57
daal::algorithms::math::abs::value
Definition: abs_types.h:88
daal::algorithms::classifier::prediction::model
Definition: classifier_predict_types.h:68

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