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

multi_class_classifier_predict.h
1 /* file: multi_class_classifier_predict.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 // Implementation of the interface for multi-class classifier model-based prediction
45 // in the batch processing mode
46 //--
47 */
48 
49 #ifndef __MULTI_CLASS_CLASSIFIER_PREDICT_H__
50 #define __MULTI_CLASS_CLASSIFIER_PREDICT_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/classifier/classifier_predict.h"
56 #include "algorithms/multi_class_classifier/multi_class_classifier_predict_types.h"
57 #include "algorithms/multi_class_classifier/multi_class_classifier_train_types.h"
58 
59 namespace daal
60 {
61 namespace algorithms
62 {
63 namespace multi_class_classifier
64 {
68 namespace prediction
69 {
70 
74 namespace interface1
75 {
89 template<typename algorithmFPType, prediction::Method pmethod, training::Method tmethod, CpuType cpu>
90 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
91 {
92 public:
98  BatchContainer(daal::services::Environment::env *daalEnv);
100  ~BatchContainer();
106  services::Status compute() DAAL_C11_OVERRIDE;
107 };
108 
130 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, prediction::Method pmethod = defaultDense, training::Method tmethod = training::oneAgainstOne>
131 class Batch : public classifier::prediction::Batch
132 {
133 public:
134  Input input;
135  Parameter parameter;
141  DAAL_DEPRECATED Batch() : parameter(0)
142  {
143  initialize();
144  }
145 
150  Batch(size_t nClasses) : parameter(nClasses)
151  {
152  initialize();
153  }
154 
161  Batch(const Batch<algorithmFPType, pmethod, tmethod> &other) : classifier::prediction::Batch(other),
162  parameter(other.parameter), input(other.input)
163  {
164  initialize();
165  }
166 
167  virtual ~Batch() {}
168 
173  Input * getInput() DAAL_C11_OVERRIDE { return &input; }
174 
179  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)pmethod; }
180 
186  services::SharedPtr<Batch<algorithmFPType, pmethod, tmethod> > clone() const
187  {
188  return services::SharedPtr<Batch<algorithmFPType, pmethod, tmethod> >(cloneImpl());
189  }
190 
191 protected:
192 
193  virtual Batch<algorithmFPType, pmethod, tmethod> * cloneImpl() const DAAL_C11_OVERRIDE
194  {
195  return new Batch<algorithmFPType, pmethod, tmethod>(*this);
196  }
197 
198  services::Status allocateResult() DAAL_C11_OVERRIDE
199  {
200  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, (int) pmethod);
201  _res = _result.get();
202  return s;
203  }
204 
205  void initialize()
206  {
207  _in = &input;
208  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, pmethod, tmethod)(&_env);
209  _par = &parameter;
210  }
211 };
213 } // namespace interface1
214 using interface1::BatchContainer;
215 using interface1::Batch;
216 
217 } // namespace prediction
218 } // namespace multi_class_classifier
219 } // namespace algorithms
220 } // namespace daal
221 #endif
daal
Definition: algorithm_base_common.h:57
daal::algorithms::multi_class_classifier::prediction::interface1::BatchContainer
Provides methods to run implementations of the multi-class classifier prediction algorithm.
Definition: multi_class_classifier_predict.h:90
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:66
daal_defines.h
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::parameter
Parameter parameter
Definition: multi_class_classifier_predict.h:135
daal::algorithms::multi_class_classifier::prediction::interface1::Input
Input objects in the prediction stage of the Multi-class classifier algorithm.
Definition: multi_class_classifier_predict_types.h:85
daal::batch
Definition: daal_defines.h:131
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: multi_class_classifier_predict.h:179
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::Batch
DAAL_DEPRECATED Batch()
Definition: multi_class_classifier_predict.h:141
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::getInput
Input * getInput() DAAL_C11_OVERRIDE
Definition: multi_class_classifier_predict.h:173
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, pmethod, tmethod > > clone() const
Definition: multi_class_classifier_predict.h:186
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:102
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::Batch
Batch(size_t nClasses)
Definition: multi_class_classifier_predict.h:150
daal::algorithms::multi_class_classifier::prediction::interface1::Batch
Provides methods to run implementations of the multi-class classifier prediction algorithm.
Definition: multi_class_classifier_predict.h:131
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::input
Input input
Definition: multi_class_classifier_predict.h:134
daal::algorithms::multi_class_classifier::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, pmethod, tmethod > &other)
Definition: multi_class_classifier_predict.h:161

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