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

decision_tree_regression_training_batch.h
1 /* file: decision_tree_regression_training_batch.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 // Implementation of the interface for Decision tree model-based training in the batch processing mode
19 //--
20 */
21 
22 #ifndef __DECISION_TREE_REGRESSION_TRAINING_BATCH_H__
23 #define __DECISION_TREE_REGRESSION_TRAINING_BATCH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "algorithms/decision_tree/decision_tree_regression_training_types.h"
27 #include "algorithms/decision_tree/decision_tree_regression_model.h"
28 #include "algorithms/regression/regression_training_batch.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace decision_tree
35 {
36 namespace regression
37 {
38 namespace training
39 {
40 namespace interface1
41 {
52 template <typename algorithmFPType, Method method, CpuType cpu>
53 class DAAL_EXPORT BatchContainer : public TrainingContainerIface<batch>
54 {
55 public:
60  BatchContainer(daal::services::Environment::env * daalEnv);
61 
63  ~BatchContainer();
64 
68  services::Status compute() DAAL_C11_OVERRIDE;
69 };
70 
86 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
87 class DAAL_EXPORT Batch : public algorithms::regression::training::Batch
88 {
89 public:
90  typedef algorithms::regression::training::Batch super;
91 
92  typedef algorithms::decision_tree::regression::training::Input InputType;
93  typedef algorithms::decision_tree::regression::Parameter ParameterType;
94  typedef algorithms::decision_tree::regression::training::Result ResultType;
95 
96  InputType input;
97  ParameterType parameter;
100  Batch()
101  {
102  initialize();
103  }
104 
110  Batch(const Batch<algorithmFPType, method> & other) :
111  algorithms::regression::training::Batch(other), input(other.input), parameter(other.parameter)
112  {
113  initialize();
114  }
115 
116  virtual algorithms::regression::training::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
117 
122  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
123 
128  ResultPtr getResult() { return ResultType::cast(_result); }
129 
133  void resetResult() // DAAL_C11_OVERRIDE
134  {
135  _result.reset(new ResultType());
136  _res = NULL;
137  }
138 
145  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
146  {
147  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
148  }
149 
150 protected:
151  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
152  {
153  return new Batch<algorithmFPType, method>(*this);
154  }
155 
156  services::Status allocateResult() DAAL_C11_OVERRIDE
157  {
158  services::Status s = getResult()->template allocate<algorithmFPType>(&input, &parameter, method);
159  _res = _result.get();
160  return s;
161  }
162 
163  void initialize()
164  {
165  _in = &input;
166  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
167  _par = &parameter;
168  _result.reset(new ResultType());
169  }
170 };
172 } // namespace interface1
173 
174 using interface1::BatchContainer;
175 using interface1::Batch;
176 
177 } // namespace training
178 } // namespace regression
179 } // namespace decision_tree
180 } // namespace algorithms
181 } // namespace daal
182 
183 #endif
daal::algorithms::decision_tree::regression::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_tree_regression_training_batch.h:145
daal::algorithms::decision_tree::regression::training::interface1::Batch::parameter
ParameterType parameter
Definition: decision_tree_regression_training_batch.h:97
daal
Definition: algorithm_base_common.h:31
daal::algorithms::decision_tree::regression::training::interface1::Batch::resetResult
void resetResult()
Definition: decision_tree_regression_training_batch.h:133
daal::algorithms::decision_tree::regression::training::interface1::BatchContainer
Class containing methods for Decision tree model-based training using algorithmFPType precision arith...
Definition: decision_tree_regression_training_batch.h:53
daal::algorithms::decision_tree::regression::training::interface1::Batch::input
InputType input
Definition: decision_tree_regression_training_batch.h:96
daal::algorithms::decision_tree::regression::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: decision_tree_regression_training_batch.h:128
daal::batch
Definition: daal_defines.h:106
daal::algorithms::decision_tree::regression::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_tree_regression_training_batch.h:110
daal::algorithms::decision_tree::regression::training::interface1::Batch
Provides methods for Decision tree model-based training in the batch processing mode.
Definition: decision_tree_regression_training_batch.h:87
daal::algorithms::decision_tree::regression::training::interface1::Batch::Batch
Batch()
Definition: decision_tree_regression_training_batch.h:100
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:50
daal::algorithms::decision_tree::regression::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_tree_regression_training_batch.h:122

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