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

classifier_training_types.h
1 /* file: classifier_training_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the base classes used in the training stage
45 // of the classification algorithms
46 //--
47 */
48 
49 #ifndef __CLASSIFIER_TRAINING_TYPES_H__
50 #define __CLASSIFIER_TRAINING_TYPES_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "algorithms/classifier/classifier_model.h"
54 
55 namespace daal
56 {
57 namespace algorithms
58 {
67 namespace classifier
68 {
78 namespace training
79 {
84 enum InputId
85 {
86  data,
87  labels,
88  weights,
89  lastInputId = weights
90 };
91 
96 enum PartialResultId
97 {
98  partialModel,
99  lastPartialResultId = partialModel
100 };
101 
106 enum ResultId
107 {
108  model,
109  lastResultId = model
110 };
111 
115 namespace interface1
116 {
121 class DAAL_EXPORT InputIface : public daal::algorithms::Input
122 {
123 public:
124  InputIface(size_t nElements);
125  InputIface(const InputIface& other) : daal::algorithms::Input(other){}
126  virtual ~InputIface() {}
127  virtual size_t getNumberOfFeatures() const = 0;
128 };
129 
134 class DAAL_EXPORT Input : public InputIface
135 {
136 public:
137  Input(size_t nElements = lastInputId + 1);
138  Input(const Input& other) : InputIface(other){}
139 
140  virtual ~Input() {}
141 
142  virtual size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
143 
149  data_management::NumericTablePtr get(InputId id) const;
150 
156  void set(InputId id, const data_management::NumericTablePtr &value);
157 
163  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
164 
165 protected:
166 
167  services::Status checkImpl(const daal::algorithms::Parameter *parameter) const;
168 };
169 
175 class DAAL_EXPORT PartialResult : public daal::algorithms::PartialResult
176 {
177 public:
178  DECLARE_SERIALIZABLE_CAST(PartialResult);
179  PartialResult();
180  virtual ~PartialResult() {}
181 
187  classifier::ModelPtr get(PartialResultId id) const;
188 
194  void set(PartialResultId id, const daal::algorithms::classifier::ModelPtr &value);
195 
202  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
203 
204 protected:
206  template<typename Archive, bool onDeserialize>
207  services::Status serialImpl(Archive *arch)
208  {
209  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
210  }
211 
212  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
213 };
214 typedef services::SharedPtr<PartialResult> PartialResultPtr;
215 
222 class DAAL_EXPORT Result : public daal::algorithms::Result
223 {
224 public:
225  DECLARE_SERIALIZABLE_CAST(Result);
226  Result();
227  virtual ~Result() {}
228 
234  daal::algorithms::classifier::ModelPtr get(ResultId id) const;
235 
241  void set(ResultId id, const daal::algorithms::classifier::ModelPtr &value);
242 
249  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter,
250  int method) const DAAL_C11_OVERRIDE;
251 
252 protected:
253  Result(const size_t n);
254  services::Status checkImpl(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter) const;
255 
257  template<typename Archive, bool onDeserialize>
258  services::Status serialImpl(Archive *arch)
259  {
260  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
261  }
262 };
263 typedef services::SharedPtr<Result> ResultPtr;
264 
265 } // namespace interface1
266 using interface1::InputIface;
267 using interface1::Input;
268 using interface1::PartialResult;
269 using interface1::PartialResultPtr;
270 using interface1::Result;
271 using interface1::ResultPtr;
272 
273 } // namespace daal::algorithms::classifier::training
275 } // namespace daal::algorithms::classifier
276 } // namespace daal::algorithms
277 } // namespace daal
278 #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:134
daal::algorithms::classifier::training::model
Definition: classifier_training_types.h:108
daal
Definition: algorithm_base_common.h:57
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:121
daal::algorithms::classifier::training::InputId
InputId
Definition: classifier_training_types.h:84
daal::algorithms::classifier::training::weights
Definition: classifier_training_types.h:88
daal::algorithms::classifier::training::labels
Definition: classifier_training_types.h:87
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:175
daal::algorithms::classifier::training::data
Definition: classifier_training_types.h:86
daal::algorithms::classifier::training::partialModel
Definition: classifier_training_types.h:98
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:222
daal::algorithms::classifier::training::ResultId
ResultId
Definition: classifier_training_types.h:106
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::classifier::training::PartialResultId
PartialResultId
Definition: classifier_training_types.h:96

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