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

decision_forest_regression_training_batch.h
1 /* file: decision_forest_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 forest model-based training
19 // in the batch processing mode
20 //--
21 */
22 
23 #ifndef __DECISION_FOREST_REGRESSSION_TRAINING_BATCH_H__
24 #define __DECISION_FOREST_REGRESSSION_TRAINING_BATCH_H__
25 
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "services/daal_memory.h"
30 #include "algorithms/decision_forest/decision_forest_regression_training_types.h"
31 #include "algorithms/decision_forest/decision_forest_regression_model.h"
32 #include "algorithms/regression/regression_training_batch.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
38 namespace decision_forest
39 {
40 namespace regression
41 {
42 namespace training
43 {
44 namespace interface1
45 {
56 template<typename algorithmFPType, Method method, CpuType cpu>
57 class DAAL_EXPORT BatchContainer : public TrainingContainerIface<batch>
58 {
59 public:
65  BatchContainer(daal::services::Environment::env *daalEnv);
67  ~BatchContainer();
72  services::Status compute() DAAL_C11_OVERRIDE;
73  services::Status setupCompute() DAAL_C11_OVERRIDE;
74 };
75 
91 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
92 class DAAL_EXPORT Batch : public algorithms::regression::training::Batch
93 {
94 public:
95  typedef algorithms::decision_forest::regression::training::Input InputType;
96  typedef algorithms::decision_forest::regression::training::Parameter ParameterType;
97  typedef algorithms::decision_forest::regression::training::Result ResultType;
98 
99  InputType input;
100  ParameterType parameter;
103  Batch() : parameter()
104  {
105  initialize();
106  parameter.minObservationsInLeafNode = 5;
107  }
108 
115  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
116  {
117  initialize();
118  }
119 
120  ~Batch() {}
121 
122  virtual algorithms::regression::training::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
123 
128  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
129 
134  ResultPtr getResult() { return ResultType::cast(_result); }
135 
142  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
143  {
144  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
145  }
146 
147 protected:
148 
149  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
150  {
151  return new Batch<algorithmFPType, method>(*this);
152  }
153 
154  services::Status allocateResult() DAAL_C11_OVERRIDE
155  {
156  services::Status s = getResult()->template allocate<algorithmFPType>(&input, &parameter, method);
157  _res = _result.get();
158  return s;
159  }
160 
161  void initialize()
162  {
163  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
164  _in = &input;
165  _par = &parameter;
166  _result.reset(new ResultType());
167  }
168 };
170 } // namespace interface1
171 using interface1::BatchContainer;
172 using interface1::Batch;
173 }
174 }
175 }
176 }
177 }
178 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::decision_forest::regression::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: decision_forest_regression_training_batch.h:142
daal::algorithms::decision_forest::regression::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: decision_forest_regression_training_batch.h:115
daal::algorithms::decision_forest::regression::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: decision_forest_regression_training_batch.h:134
daal::algorithms::decision_forest::regression::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: decision_forest_regression_training_batch.h:128
daal_defines.h
daal::batch
Definition: daal_defines.h:106
daal::algorithms::decision_forest::regression::training::interface1::Batch::parameter
ParameterType parameter
Definition: decision_forest_regression_training_batch.h:100
daal::algorithms::decision_forest::regression::training::interface1::Batch
Provides methods for decision forest model-based training in the batch processing mode...
Definition: decision_forest_regression_training_batch.h:92
daal::algorithms::decision_forest::regression::training::interface1::Batch::Batch
Batch()
Definition: decision_forest_regression_training_batch.h:103
daal::algorithms::decision_forest::regression::training::interface1::BatchContainer
Class containing methods for decision forest regression model-based training using algorithmFPType pr...
Definition: decision_forest_regression_training_batch.h:57
daal::algorithms::decision_forest::regression::training::interface1::Batch::input
InputType input
Definition: decision_forest_regression_training_batch.h:99
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:50

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