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

multi_class_classifier_model.h
1 /* file: multi_class_classifier_model.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 // Multiclass tcc parameter structure
19 //--
20 */
21 
22 #ifndef __MULTI_CLASS_CLASSIFIER_MODEL_H__
23 #define __MULTI_CLASS_CLASSIFIER_MODEL_H__
24 
25 #include "services/daal_defines.h"
26 #include "algorithms/model.h"
27 #include "algorithms/classifier/classifier_model.h"
28 #include "algorithms/classifier/classifier_predict.h"
29 #include "algorithms/classifier/classifier_training_batch.h"
30 
31 namespace daal
32 {
33 namespace algorithms
34 {
44 namespace multi_class_classifier
45 {
46 
50 namespace interface1
51 {
62 /* [ParameterBase source code] */
63 struct DAAL_EXPORT ParameterBase : public daal::algorithms::classifier::Parameter
64 {
65  ParameterBase(size_t nClasses): daal::algorithms::classifier::Parameter(nClasses), training(), prediction() {}
66  services::SharedPtr<algorithms::classifier::training::Batch> training;
67  services::SharedPtr<algorithms::classifier::prediction::Batch> prediction;
68 };
69 /* [ParameterBase source code] */
70 
77 /* [Parameter source code] */
78 struct DAAL_EXPORT Parameter : public ParameterBase
79 {
80  Parameter(size_t nClasses, size_t maxIterations = 100, double accuracyThreshold = 1.0e-12) :
81  ParameterBase(nClasses), maxIterations(maxIterations), accuracyThreshold(accuracyThreshold) {}
82 
83  size_t maxIterations;
84  double accuracyThreshold;
86  services::Status check() const DAAL_C11_OVERRIDE;
87 };
88 /* [Parameter source code] */
89 
94 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
95 {
96 public:
97  DECLARE_MODEL(Model, classifier::Model);
98 
105  Model(size_t nFeatures, const ParameterBase *par);
106 
111  Model();
112 
120  static services::SharedPtr<Model> create(size_t nFeatures, const ParameterBase *par, services::Status* stat = NULL);
121 
122  virtual ~Model();
123 
128  data_management::DataCollectionPtr getMultiClassClassifierModel()
129  {
130  return _models;
131  }
132 
138  DAAL_DEPRECATED classifier::ModelPtr *getTwoClassClassifierModels();
139 
145  void setTwoClassClassifierModel(size_t idx, const classifier::ModelPtr& model);
146 
152  classifier::ModelPtr getTwoClassClassifierModel(size_t idx) const;
153 
158  size_t getNumberOfTwoClassClassifierModels() const
159  {
160  return _models->size();
161  }
162 
167  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
168 
169 protected:
170  size_t _nFeatures;
171  data_management::DataCollectionPtr _models; /* Collection of two-class classifiers associated with the model */
172  classifier::ModelPtr *_modelsArray;
173 
174  Model(size_t nFeatures, const ParameterBase *par, services::Status &st);
175 
176  template<typename Archive, bool onDeserialize>
177  services::Status serialImpl(Archive *arch)
178  {
179  services::Status st = classifier::Model::serialImpl<Archive, onDeserialize>(arch);
180  if (!st)
181  return st;
182  arch->set(_nFeatures);
183  arch->setSharedPtrObj(_models);
184 
185  return st;
186  }
187 };
188 typedef services::SharedPtr<Model> ModelPtr;
189 } // namespace interface1
190 using interface1::ParameterBase;
191 using interface1::Parameter;
192 using interface1::Model;
193 using interface1::ModelPtr;
194 
195 } // namespace multi_class_classifier
197 } // namespace algorithms
198 } // namespace daal
199 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::multi_class_classifier::interface1::Model
Model of the classifier trained by the multi_class_classifier::training::Batch algorithm.
Definition: multi_class_classifier_model.h:94
daal::algorithms::multi_class_classifier::interface1::Parameter
Optional multi-class classifier algorithm parameters that are used with the MultiClassClassifierWu pr...
Definition: multi_class_classifier_model.h:78
daal::algorithms::classifier::prediction::model
Definition: classifier_predict_types.h:66
daal_defines.h
daal::algorithms::multi_class_classifier::interface1::Parameter::maxIterations
size_t maxIterations
Definition: multi_class_classifier_model.h:83
daal::algorithms::multi_class_classifier::interface1::ParameterBase
Parameters of the multi-class classifier algorithm.
Definition: multi_class_classifier_model.h:63
daal::algorithms::multi_class_classifier::interface1::ParameterBase::prediction
services::SharedPtr< algorithms::classifier::prediction::Batch > prediction
Definition: multi_class_classifier_model.h:67
daal::algorithms::multi_class_classifier::interface1::Model::getNumberOfFeatures
size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE
Definition: multi_class_classifier_model.h:167
daal::algorithms::multi_class_classifier::interface1::ParameterBase::training
services::SharedPtr< algorithms::classifier::training::Batch > training
Definition: multi_class_classifier_model.h:66
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::multi_class_classifier::interface1::Model::getNumberOfTwoClassClassifierModels
size_t getNumberOfTwoClassClassifierModels() const
Definition: multi_class_classifier_model.h:158
daal::algorithms::multi_class_classifier::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: multi_class_classifier_model.h:84
daal::algorithms::multi_class_classifier::interface1::Model::getMultiClassClassifierModel
data_management::DataCollectionPtr getMultiClassClassifierModel()
Definition: multi_class_classifier_model.h:128

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