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

classifier_training_types.h
1 /* file: classifier_training_types.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 base classes used in the training stage
19 // of the classification algorithms
20 //--
21 */
22 
23 #ifndef __CLASSIFIER_TRAINING_TYPES_H__
24 #define __CLASSIFIER_TRAINING_TYPES_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "algorithms/classifier/classifier_model.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
41 namespace classifier
42 {
52 namespace training
53 {
58 enum InputId
59 {
60  data,
61  labels,
62  weights,
63  lastInputId = weights
64 };
65 
70 enum PartialResultId
71 {
72  partialModel,
73  lastPartialResultId = partialModel
74 };
75 
80 enum ResultId
81 {
82  model,
83  lastResultId = model
84 };
85 
89 namespace interface1
90 {
95 class DAAL_EXPORT InputIface : public daal::algorithms::Input
96 {
97 public:
98  InputIface(size_t nElements);
99  InputIface(const InputIface& other) : daal::algorithms::Input(other){}
100  virtual ~InputIface() {}
101  virtual size_t getNumberOfFeatures() const = 0;
102 };
103 
108 class DAAL_EXPORT Input : public InputIface
109 {
110 public:
111  Input(size_t nElements = lastInputId + 1);
112  Input(const Input& other) : InputIface(other){}
113 
114  virtual ~Input() {}
115 
116  virtual size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
117 
123  data_management::NumericTablePtr get(InputId id) const;
124 
130  void set(InputId id, const data_management::NumericTablePtr &value);
131 
137  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
138 
139 protected:
140 
141  services::Status checkImpl(const daal::algorithms::Parameter *parameter) const;
142 };
143 
149 class DAAL_EXPORT PartialResult : public daal::algorithms::PartialResult
150 {
151 public:
152  DECLARE_SERIALIZABLE_CAST(PartialResult);
153  PartialResult();
154  virtual ~PartialResult() {}
155 
161  classifier::ModelPtr get(PartialResultId id) const;
162 
168  void set(PartialResultId id, const daal::algorithms::classifier::ModelPtr &value);
169 
176  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
177 
178 protected:
180  template<typename Archive, bool onDeserialize>
181  services::Status serialImpl(Archive *arch)
182  {
183  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
184  }
185 
186  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
187 };
188 typedef services::SharedPtr<PartialResult> PartialResultPtr;
189 
196 class DAAL_EXPORT Result : public daal::algorithms::Result
197 {
198 public:
199  DECLARE_SERIALIZABLE_CAST(Result);
200  Result();
201  virtual ~Result() {}
202 
208  daal::algorithms::classifier::ModelPtr get(ResultId id) const;
209 
215  void set(ResultId id, const daal::algorithms::classifier::ModelPtr &value);
216 
223  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter,
224  int method) const DAAL_C11_OVERRIDE;
225 
226 protected:
227  Result(const size_t n);
228  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
229 
231  template<typename Archive, bool onDeserialize>
232  services::Status serialImpl(Archive *arch)
233  {
234  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
235  }
236 };
237 typedef services::SharedPtr<Result> ResultPtr;
238 
239 } // namespace interface1
240 using interface1::InputIface;
241 using interface1::Input;
242 using interface1::PartialResult;
243 using interface1::PartialResultPtr;
244 using interface1::Result;
245 using interface1::ResultPtr;
246 
247 } // namespace daal::algorithms::classifier::training
249 } // namespace daal::algorithms::classifier
250 } // namespace daal::algorithms
251 } // namespace daal
252 #endif
daal::algorithms::classifier::training::interface1::Input
Base class for the input objects in the training stage of the classification algorithms.
Definition: classifier_training_types.h:108
daal::algorithms::classifier::training::model
Definition: classifier_training_types.h:82
daal
Definition: algorithm_base_common.h:31
daal::algorithms::classifier::training::interface1::InputIface
Abstract class that specifies the interface of the classes of the classification algorithm input obje...
Definition: classifier_training_types.h:95
daal::algorithms::classifier::training::InputId
InputId
Definition: classifier_training_types.h:58
daal::algorithms::classifier::training::weights
Definition: classifier_training_types.h:62
daal::algorithms::classifier::training::labels
Definition: classifier_training_types.h:61
daal::algorithms::classifier::training::interface1::PartialResult
Provides methods to access partial results obtained with the compute() method of the classifier train...
Definition: classifier_training_types.h:149
daal::algorithms::classifier::training::data
Definition: classifier_training_types.h:60
daal::algorithms::classifier::training::partialModel
Definition: classifier_training_types.h:72
daal::algorithms::classifier::training::interface1::Result
Provides methods to access final results obtained with the compute() method in the batch processing m...
Definition: classifier_training_types.h:196
daal::algorithms::classifier::training::ResultId
ResultId
Definition: classifier_training_types.h:80
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::algorithms::classifier::training::PartialResultId
PartialResultId
Definition: classifier_training_types.h:70

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