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

multi_class_classifier_model.h
1 /* file: multi_class_classifier_model.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 // Multiclass tcc parameter structure
45 //--
46 */
47 
48 #ifndef __MULTI_CLASS_CLASSIFIER_MODEL_H__
49 #define __MULTI_CLASS_CLASSIFIER_MODEL_H__
50 
51 #include "services/daal_defines.h"
52 #include "algorithms/model.h"
53 #include "algorithms/classifier/classifier_model.h"
54 #include "algorithms/classifier/classifier_predict.h"
55 #include "algorithms/classifier/classifier_training_batch.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
70 namespace multi_class_classifier
71 {
72 
76 namespace interface1
77 {
88 /* [ParameterBase source code] */
89 struct DAAL_EXPORT ParameterBase : public daal::algorithms::classifier::Parameter
90 {
91  ParameterBase(size_t nClasses): daal::algorithms::classifier::Parameter(nClasses), training(), prediction() {}
92  services::SharedPtr<algorithms::classifier::training::Batch> training;
93  services::SharedPtr<algorithms::classifier::prediction::Batch> prediction;
94 };
95 /* [ParameterBase source code] */
96 
103 /* [Parameter source code] */
104 struct DAAL_EXPORT Parameter : public ParameterBase
105 {
106  Parameter(size_t nClasses, size_t maxIterations = 100, double accuracyThreshold = 1.0e-12) :
107  ParameterBase(nClasses), maxIterations(maxIterations), accuracyThreshold(accuracyThreshold) {}
108 
109  size_t maxIterations;
110  double accuracyThreshold;
112  services::Status check() const DAAL_C11_OVERRIDE;
113 };
114 /* [Parameter source code] */
115 
120 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
121 {
122 public:
123  DECLARE_MODEL(Model, classifier::Model);
124 
131  Model(size_t nFeatures, const ParameterBase *par);
132 
137  Model();
138 
146  static services::SharedPtr<Model> create(size_t nFeatures, const ParameterBase *par, services::Status* stat = NULL);
147 
148  virtual ~Model();
149 
154  data_management::DataCollectionPtr getMultiClassClassifierModel()
155  {
156  return _models;
157  }
158 
164  DAAL_DEPRECATED classifier::ModelPtr *getTwoClassClassifierModels();
165 
171  void setTwoClassClassifierModel(size_t idx, const classifier::ModelPtr& model);
172 
178  classifier::ModelPtr getTwoClassClassifierModel(size_t idx) const;
179 
184  size_t getNumberOfTwoClassClassifierModels() const
185  {
186  return _models->size();
187  }
188 
193  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
194 
195 protected:
196  size_t _nFeatures;
197  data_management::DataCollectionPtr _models; /* Collection of two-class classifiers associated with the model */
198  classifier::ModelPtr *_modelsArray;
199 
200  Model(size_t nFeatures, const ParameterBase *par, services::Status &st);
201 
202  template<typename Archive, bool onDeserialize>
203  services::Status serialImpl(Archive *arch)
204  {
205  services::Status st = classifier::Model::serialImpl<Archive, onDeserialize>(arch);
206  if (!st)
207  return st;
208  arch->set(_nFeatures);
209  arch->setSharedPtrObj(_models);
210 
211  return st;
212  }
213 };
214 typedef services::SharedPtr<Model> ModelPtr;
215 } // namespace interface1
216 using interface1::ParameterBase;
217 using interface1::Parameter;
218 using interface1::Model;
219 using interface1::ModelPtr;
220 
221 } // namespace multi_class_classifier
223 } // namespace algorithms
224 } // namespace daal
225 #endif
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::classifier::interface1::Parameter
Base class for the parameters of the classification algorithm.
Definition: classifier_model.h:81
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:120
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:79
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:104
daal_defines.h
daal::algorithms::multi_class_classifier::interface1::Parameter::maxIterations
size_t maxIterations
Definition: multi_class_classifier_model.h:109
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::algorithms::classifier::interface1::Model
Base class for the model of the classification algorithm.
Definition: classifier_model.h:95
daal::algorithms::multi_class_classifier::interface1::ParameterBase
Parameters of the multi-class classifier algorithm.
Definition: multi_class_classifier_model.h:89
daal::algorithms::multi_class_classifier::interface1::ParameterBase::prediction
services::SharedPtr< algorithms::classifier::prediction::Batch > prediction
Definition: multi_class_classifier_model.h:93
daal::algorithms::multi_class_classifier::interface1::Model::getNumberOfFeatures
size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE
Definition: multi_class_classifier_model.h:193
daal::algorithms::multi_class_classifier::interface1::ParameterBase::training
services::SharedPtr< algorithms::classifier::training::Batch > training
Definition: multi_class_classifier_model.h:92
daal::algorithms::linear_regression::training::model
Definition: linear_regression_training_types.h:125
daal::algorithms::multi_class_classifier::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: multi_class_classifier_model.h:110
daal::algorithms::multi_class_classifier::interface1::Model::getNumberOfTwoClassClassifierModels
size_t getNumberOfTwoClassClassifierModels() const
Definition: multi_class_classifier_model.h:184

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