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

decision_forest_classification_predict.h
1 /* file: decision_forest_classification_predict.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 interface for decision forest classification model-based prediction
19 //--
20 */
21 
22 #ifndef __DECISION_FOREST_CLASSIFICATION_PREDICT_H__
23 #define __DECISION_FOREST_CLASSIFICATION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/classifier/classifier_predict.h"
27 #include "algorithms/decision_forest/decision_forest_classification_model.h"
28 #include "algorithms/decision_forest/decision_forest_classification_predict_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace decision_forest
35 {
36 namespace classification
37 {
41 namespace prediction
42 {
52 enum Method
53 {
54  defaultDense = 0
55 };
56 
60 namespace interface1
61 {
71 template<typename algorithmFPType, Method method, CpuType cpu>
72 class DAAL_EXPORT BatchContainer : public PredictionContainerIface
73 {
74 public:
79  BatchContainer(daal::services::Environment::env *daalEnv);
81  ~BatchContainer();
86  services::Status compute() DAAL_C11_OVERRIDE;
87 };
88 
109 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
110 class Batch : public classifier::prediction::Batch
111 {
112 public:
113  typedef classifier::prediction::Batch super;
114 
115  typedef algorithms::decision_forest::classification::prediction::Input InputType;
116  typedef typename super::ParameterType ParameterType;
117  typedef typename super::ResultType ResultType;
118 
119  InputType input;
120  ParameterType parameter;
126  Batch(size_t nClasses): parameter(nClasses)
127  {
128  initialize();
129  };
130 
137  Batch(const Batch<algorithmFPType, method> &other) : classifier::prediction::Batch(other),
138  input(other.input), parameter(other.parameter)
139  {
140  initialize();
141  }
142 
143  ~Batch() {}
144 
149  InputType * getInput() DAAL_C11_OVERRIDE { return &input; }
150 
155  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
156 
162  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
163  {
164  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
165  }
166 
167 protected:
168  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
169  {
170  return new Batch<algorithmFPType, method>(*this);
171  }
172 
173  services::Status allocateResult() DAAL_C11_OVERRIDE
174  {
175  services::Status s = _result->allocate<algorithmFPType>(&input, 0, 0);
176  _res = _result.get();
177  return s;
178  }
179 
180  void initialize()
181  {
182  _in = &input;
183  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
184  _par = &parameter;
185  }
186 };
188 } // namespace interface1
189 using interface1::BatchContainer;
190 using interface1::Batch;
191 
192 } // namespace daal::algorithms::decision_forest::classification::prediction
193 }
194 }
195 }
196 } // namespace daal
197 #endif
daal::algorithms::decision_forest::classification::prediction::interface1::BatchContainer
Provides methods to run implementations of the decision_forest algorithm. This class is associated wi...
Definition: decision_forest_classification_predict.h:72
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::input
InputType input
Definition: decision_forest_classification_predict.h:119
daal::algorithms::decision_forest::classification::prediction::Method
Method
Definition: decision_forest_classification_predict.h:52
daal
Definition: algorithm_base_common.h:31
daal::algorithms::PredictionContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the algor...
Definition: prediction.h:40
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::getInput
InputType * getInput() DAAL_C11_OVERRIDE
Definition: decision_forest_classification_predict.h:149
daal::batch
Definition: daal_defines.h:110
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::Batch
Batch(size_t nClasses)
Definition: decision_forest_classification_predict.h:126
daal::algorithms::decision_forest::classification::prediction::defaultDense
Definition: decision_forest_classification_predict.h:54
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_forest_classification_predict.h:155
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_forest_classification_predict.h:162
daal::algorithms::decision_forest::classification::prediction::interface1::Batch
Predicts decision_forest classification results.
Definition: decision_forest_classification_predict.h:110
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_forest_classification_predict.h:137
daal::algorithms::decision_forest::classification::prediction::interface1::Batch::parameter
ParameterType parameter
Definition: decision_forest_classification_predict.h:120

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