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

kdtree_knn_classification_model.h
1 /* file: kdtree_knn_classification_model.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 class defining the K-Nearest Neighbors (kNN) classification model
21 //--
22 */
23 
24 #ifndef __KDTREE_KNN_CLASSIFICATION_MODEL_H__
25 #define __KDTREE_KNN_CLASSIFICATION_MODEL_H__
26 
27 #include "algorithms/classifier/classifier_model.h"
28 #include "data_management/data/aos_numeric_table.h"
29 #include "data_management/data/soa_numeric_table.h"
30 #include "data_management/data/homogen_numeric_table.h"
31 #include "algorithms/engines/mcg59/mcg59.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 
48 namespace kdtree_knn_classification
49 {
50 
55 enum DataUseInModel
56 {
57  doNotUse = 0,
58  doUse = 1
59 };
60 
64 namespace interface1
65 {
66 
73 /* [interface1::Parameter source code] */
74 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::interface1::Parameter
75 {
83  DAAL_DEPRECATED Parameter(size_t nClasses = 2, size_t nNeighbors = 1, int randomSeed = 777, DataUseInModel dataUse = doNotUse)
84  : daal::algorithms::classifier::interface1::Parameter(nClasses),
85  k(nNeighbors),
86  seed(randomSeed),
87  dataUseInModel(dataUse),
88  engine(engines::mcg59::Batch<>::create())
89  {}
90 
94  DAAL_DEPRECATED services::Status check() const DAAL_C11_OVERRIDE;
95 
96  size_t k;
97  int seed;
98  DataUseInModel dataUseInModel;
99  engines::EnginePtr engine;
100 };
101 /* [interface1::Parameter source code] */
102 }
103 
107 namespace interface2
108 {
109 
116 /* [Parameter source code] */
117 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::Parameter
118 {
126  Parameter(size_t nClasses = 2, size_t nNeighbors = 1, int randomSeed = 777, DataUseInModel dataUse = doNotUse)
127  : daal::algorithms::classifier::Parameter(nClasses),
128  k(nNeighbors),
129  seed(randomSeed),
130  dataUseInModel(dataUse),
131  engine(engines::mcg59::Batch<>::create())
132  {}
133 
137  services::Status check() const DAAL_C11_OVERRIDE;
138 
139  size_t k;
140  int seed;
141  DataUseInModel dataUseInModel;
142  engines::EnginePtr engine;
143 };
144 /* [Parameter source code] */
145 }
146 
150 namespace interface1
151 {
163 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
164 {
165 public:
166  DECLARE_MODEL_IFACE(Model, classifier::Model);
172  Model(size_t nFeatures = 0);
173 
179  static services::SharedPtr<Model> create(size_t nFeatures = 0, services::Status *stat = NULL);
180 
181  virtual ~Model();
182 
183 
184  class ModelImpl;
185 
190  const ModelImpl *impl() const { return _impl; }
191 
196  ModelImpl *impl() { return _impl; }
197 
202  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
203 
204 protected:
205  Model(size_t nFeatures, services::Status &st);
206 
207  services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE;
208 
209  services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE;
210 
211 private:
212  ModelImpl *_impl;
213 };
214 typedef services::SharedPtr<Model> ModelPtr;
215 } // namespace interface1
216 
217 using interface2::Parameter;
218 using interface1::Model;
219 using interface1::ModelPtr;
220 
221 } // namespace kdtree_knn_classification
222 
224 } // namespace algorithms
225 } // namespace daal
226 
227 #endif
daal::algorithms::kdtree_knn_classification::interface1::Model::impl
ModelImpl * impl()
Definition: kdtree_knn_classification_model.h:196
daal::algorithms::kdtree_knn_classification::interface1::Parameter
KD-tree based kNN algorithm parameters.
Definition: kdtree_knn_classification_model.h:74
daal::algorithms::kdtree_knn_classification::DataUseInModel
DataUseInModel
The option to enable/disable an usage of the input dataset in kNN model.
Definition: kdtree_knn_classification_model.h:55
daal::algorithms::kdtree_knn_classification::doNotUse
Definition: kdtree_knn_classification_model.h:57
daal::algorithms::kdtree_knn_classification::interface2::Parameter::Parameter
Parameter(size_t nClasses=2, size_t nNeighbors=1, int randomSeed=777, DataUseInModel dataUse=doNotUse)
Definition: kdtree_knn_classification_model.h:126
daal::algorithms::kdtree_knn_classification::interface2::Parameter
KD-tree based kNN algorithm parameters.
Definition: kdtree_knn_classification_model.h:117
daal::algorithms::kdtree_knn_classification::doUse
Definition: kdtree_knn_classification_model.h:58
daal::algorithms::classifier::interface1::Parameter
Base class for the parameters of the classification algorithm.
Definition: classifier_model.h:69
daal::algorithms::kdtree_knn_classification::interface1::Parameter::Parameter
DAAL_DEPRECATED Parameter(size_t nClasses=2, size_t nNeighbors=1, int randomSeed=777, DataUseInModel dataUse=doNotUse)
Definition: kdtree_knn_classification_model.h:83
daal::algorithms::kdtree_knn_classification::interface1::Model
Base class for models trained with the KD-tree based kNN algorithm
Definition: kdtree_knn_classification_model.h:163
daal::algorithms::kdtree_knn_classification::interface1::Model::impl
const ModelImpl * impl() const
Definition: kdtree_knn_classification_model.h:190

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