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

classifier_training_types.h
1 /* file: classifier_training_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 training stage
21 // of the classification algorithms
22 //--
23 */
24 
25 #ifndef __CLASSIFIER_TRAINING_TYPES_H__
26 #define __CLASSIFIER_TRAINING_TYPES_H__
27 
28 #include "algorithms/algorithm.h"
29 #include "algorithms/classifier/classifier_model.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
43 namespace classifier
44 {
54 namespace training
55 {
60 enum InputId
61 {
62  data,
63  labels,
64  weights,
65  lastInputId = weights
66 };
67 
72 enum PartialResultId
73 {
74  partialModel,
75  lastPartialResultId = partialModel
76 };
77 
82 enum ResultId
83 {
84  model,
85  lastResultId = model
86 };
87 
91 namespace interface1
92 {
97 class DAAL_EXPORT InputIface : public daal::algorithms::Input
98 {
99 public:
100  InputIface(size_t nElements);
101  InputIface(const InputIface& other) : daal::algorithms::Input(other){}
102  virtual ~InputIface() {}
103  virtual size_t getNumberOfFeatures() const = 0;
104 };
105 
110 class DAAL_EXPORT Input : public InputIface
111 {
112 public:
113  Input(size_t nElements = lastInputId + 1);
114  Input(const Input& other) : InputIface(other){}
115 
116  virtual ~Input() {}
117 
118  virtual size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
119 
125  data_management::NumericTablePtr get(InputId id) const;
126 
132  void set(InputId id, const data_management::NumericTablePtr &value);
133 
139  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
140 
141 protected:
142 
143  services::Status checkImpl(const daal::algorithms::Parameter *parameter) const;
144 };
145 
151 class DAAL_EXPORT PartialResult : public daal::algorithms::PartialResult
152 {
153 public:
154  DECLARE_SERIALIZABLE_CAST(PartialResult);
155  PartialResult();
156  virtual ~PartialResult() {}
157 
163  classifier::ModelPtr get(PartialResultId id) const;
164 
170  void set(PartialResultId id, const daal::algorithms::classifier::ModelPtr &value);
171 
178  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
179 
180 protected:
182  template<typename Archive, bool onDeserialize>
183  services::Status serialImpl(Archive *arch)
184  {
185  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
186  }
187 
188  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
189 };
190 typedef services::SharedPtr<PartialResult> PartialResultPtr;
191 
198 class DAAL_EXPORT Result : public daal::algorithms::Result
199 {
200 public:
201  DECLARE_SERIALIZABLE_CAST(Result);
202  Result();
203  virtual ~Result() {}
204 
210  daal::algorithms::classifier::ModelPtr get(ResultId id) const;
211 
217  void set(ResultId id, const daal::algorithms::classifier::ModelPtr &value);
218 
225  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter,
226  int method) const DAAL_C11_OVERRIDE;
227 
228 protected:
229  Result(const size_t n);
230  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
231 
233  template<typename Archive, bool onDeserialize>
234  services::Status serialImpl(Archive *arch)
235  {
236  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
237  }
238 };
239 typedef services::SharedPtr<Result> ResultPtr;
240 
241 } // namespace interface1
242 using interface1::InputIface;
243 using interface1::Input;
244 using interface1::PartialResult;
245 using interface1::PartialResultPtr;
246 using interface1::Result;
247 using interface1::ResultPtr;
248 
249 } // namespace daal::algorithms::classifier::training
251 } // namespace daal::algorithms::classifier
252 } // namespace daal::algorithms
253 } // namespace daal
254 #endif
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:97
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:198
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:151
daal::algorithms::classifier::training::data
Definition: classifier_training_types.h:62
daal::algorithms::classifier::training::labels
Definition: classifier_training_types.h:63
daal::algorithms::classifier::training::InputId
InputId
Definition: classifier_training_types.h:60
daal::algorithms::classifier::training::partialModel
Definition: classifier_training_types.h:74
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:110
daal::algorithms::classifier::training::model
Definition: classifier_training_types.h:84
daal::algorithms::classifier::training::PartialResultId
PartialResultId
Definition: classifier_training_types.h:72
daal::algorithms::math::abs::value
Definition: abs_types.h:88
daal::algorithms::classifier::training::ResultId
ResultId
Definition: classifier_training_types.h:82
daal::algorithms::classifier::training::weights
Definition: classifier_training_types.h:64

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