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

multi_class_classifier_model.h
1 /* file: multi_class_classifier_model.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 // 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<classifier::training::Batch> training;
93  services::SharedPtr<classifier::prediction::Batch> prediction;
95  services::Status check() const DAAL_C11_OVERRIDE;
96 };
97 /* [ParameterBase source code] */
98 
105 /* [Parameter source code] */
106 struct DAAL_EXPORT Parameter : public ParameterBase
107 {
108  Parameter(size_t nClasses, size_t maxIterations = 100, double accuracyThreshold = 1.0e-12) :
109  ParameterBase(nClasses), maxIterations(maxIterations), accuracyThreshold(accuracyThreshold) {}
110 
111  size_t maxIterations;
112  double accuracyThreshold;
114  services::Status check() const DAAL_C11_OVERRIDE;
115 };
116 /* [Parameter source code] */
117 
122 class DAAL_EXPORT Model : public daal::algorithms::classifier::Model
123 {
124 public:
125  DECLARE_MODEL(Model, classifier::Model);
126 
133  Model(size_t nFeatures, const ParameterBase *par);
134 
139  Model();
140 
148  static services::SharedPtr<Model> create(size_t nFeatures, const ParameterBase *par, services::Status* stat = NULL);
149 
150  virtual ~Model();
151 
156  data_management::DataCollectionPtr getMultiClassClassifierModel()
157  {
158  return _models;
159  }
160 
166  DAAL_DEPRECATED classifier::ModelPtr *getTwoClassClassifierModels();
167 
173  void setTwoClassClassifierModel(size_t idx, const classifier::ModelPtr& model);
174 
180  classifier::ModelPtr getTwoClassClassifierModel(size_t idx) const;
181 
186  size_t getNumberOfTwoClassClassifierModels() const
187  {
188  return _models->size();
189  }
190 
195  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE { return _nFeatures; }
196 
197 protected:
198  size_t _nFeatures;
199  data_management::DataCollectionPtr _models; /* Collection of two-class classifiers associated with the model */
200  classifier::ModelPtr *_modelsArray;
201 
202  Model(size_t nFeatures, const ParameterBase *par, services::Status &st);
203 
204  template<typename Archive, bool onDeserialize>
205  services::Status serialImpl(Archive *arch)
206  {
207  services::Status st = classifier::Model::serialImpl<Archive, onDeserialize>(arch);
208  if (!st)
209  return st;
210  arch->set(_nFeatures);
211  arch->setSharedPtrObj(_models);
212 
213  return st;
214  }
215 };
216 typedef services::SharedPtr<Model> ModelPtr;
217 } // namespace interface1
218 using interface1::ParameterBase;
219 using interface1::Parameter;
220 using interface1::Model;
221 using interface1::ModelPtr;
222 
223 } // namespace multi_class_classifier
225 } // namespace algorithms
226 } // namespace daal
227 #endif
daal
Definition: algorithm_base_common.h:57
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:122
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:106
daal::algorithms::classifier::prediction::model
Definition: classifier_predict_types.h:92
daal_defines.h
daal::algorithms::multi_class_classifier::interface1::Parameter::maxIterations
size_t maxIterations
Definition: multi_class_classifier_model.h:111
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< 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:195
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:102
daal::algorithms::multi_class_classifier::interface1::Model::getNumberOfTwoClassClassifierModels
size_t getNumberOfTwoClassClassifierModels() const
Definition: multi_class_classifier_model.h:186
daal::algorithms::multi_class_classifier::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: multi_class_classifier_model.h:112
daal::algorithms::multi_class_classifier::interface1::Model::getMultiClassClassifierModel
data_management::DataCollectionPtr getMultiClassClassifierModel()
Definition: multi_class_classifier_model.h:156
daal::algorithms::multi_class_classifier::interface1::ParameterBase::training
services::SharedPtr< classifier::training::Batch > training
Definition: multi_class_classifier_model.h:92

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