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

kdtree_knn_classification_model.h
1 /* file: kdtree_knn_classification_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 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 class defining the K-Nearest Neighbors (kNN) classification model
19 //--
20 */
21 
22 #ifndef __KDTREE_KNN_CLASSIFICATION_MODEL_H__
23 #define __KDTREE_KNN_CLASSIFICATION_MODEL_H__
24 
25 #include "algorithms/classifier/classifier_model.h"
26 #include "data_management/data/aos_numeric_table.h"
27 #include "data_management/data/soa_numeric_table.h"
28 #include "data_management/data/homogen_numeric_table.h"
29 #include "algorithms/engines/mcg59/mcg59.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
35 
46 namespace kdtree_knn_classification
47 {
48 
53 enum DataUseInModel
54 {
55  doNotUse = 0,
56  doUse = 1
57 };
58 
62 namespace interface1
63 {
64 
71 /* [Parameter source code] */
72 struct DAAL_EXPORT Parameter : public daal::algorithms::classifier::Parameter
73 {
81  Parameter(size_t nClasses = 2, size_t nNeighbors = 1, int randomSeed = 777, DataUseInModel dataUse = doNotUse)
82  : daal::algorithms::classifier::Parameter(nClasses),
83  k(nNeighbors),
84  seed(randomSeed),
85  dataUseInModel(dataUse),
86  engine(engines::mcg59::Batch<>::create())
87  {}
88 
92  services::Status check() const DAAL_C11_OVERRIDE;
93 
94  size_t k;
95  int seed;
96  DataUseInModel dataUseInModel;
97  engines::EnginePtr engine;
98 };
99 /* [Parameter source code] */
100 
112 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
113 {
114 public:
115  DECLARE_MODEL_IFACE(Model, classifier::Model);
121  Model(size_t nFeatures = 0);
122 
128  static services::SharedPtr<Model> create(size_t nFeatures = 0, services::Status *stat = NULL);
129 
130  virtual ~Model();
131 
132 
133  class ModelImpl;
134 
139  const ModelImpl *impl() const { return _impl; }
140 
145  ModelImpl *impl() { return _impl; }
146 
151  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
152 
153 protected:
154  Model(size_t nFeatures, services::Status &st);
155 
156  services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE;
157 
158  services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE;
159 
160 private:
161  ModelImpl *_impl;
162 };
163 typedef services::SharedPtr<Model> ModelPtr;
164 } // namespace interface1
165 
166 using interface1::Parameter;
167 using interface1::Model;
168 using interface1::ModelPtr;
169 
170 } // namespace kdtree_knn_classification
171 
173 } // namespace algorithms
174 } // namespace daal
175 
176 #endif
daal::algorithms::kdtree_knn_classification::interface1::Parameter
KD-tree based kNN algorithm parameters.
Definition: kdtree_knn_classification_model.h:72
daal
Definition: algorithm_base_common.h:31
daal::algorithms::kdtree_knn_classification::doNotUse
Definition: kdtree_knn_classification_model.h:55
daal::algorithms::kdtree_knn_classification::doUse
Definition: kdtree_knn_classification_model.h:56
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:53
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:112
daal::algorithms::kdtree_knn_classification::interface1::Model::impl
const ModelImpl * impl() const
Definition: kdtree_knn_classification_model.h:139
daal::algorithms::kdtree_knn_classification::interface1::Parameter::Parameter
Parameter(size_t nClasses=2, size_t nNeighbors=1, int randomSeed=777, DataUseInModel dataUse=doNotUse)
Definition: kdtree_knn_classification_model.h:81
daal::algorithms::kdtree_knn_classification::interface1::Model::impl
ModelImpl * impl()
Definition: kdtree_knn_classification_model.h:145

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