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

ridge_regression_training_batch.h
1 /* file: ridge_regression_training_batch.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 ridge regression model-based training in the batch processing mode
19 //--
20 */
21 
22 #ifndef __RIDGE_REGRESSION_TRAINING_BATCH_H__
23 #define __RIDGE_REGRESSION_TRAINING_BATCH_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "services/daal_defines.h"
27 #include "services/daal_memory.h"
28 #include "algorithms/ridge_regression/ridge_regression_training_types.h"
29 #include "algorithms/ridge_regression/ridge_regression_model.h"
30 #include "algorithms/linear_model/linear_model_training_batch.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace ridge_regression
37 {
38 namespace training
39 {
40 namespace interface1
41 {
51 template<typename algorithmFPType, Method method, CpuType cpu>
52 class DAAL_EXPORT BatchContainer : public TrainingContainerIface<batch>
53 {
54 public:
59  BatchContainer(daal::services::Environment::env *daalEnv);
60 
62  ~BatchContainer();
63 
69  services::Status compute() DAAL_C11_OVERRIDE;
70 };
71 
88 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = normEqDense>
89 class DAAL_EXPORT Batch : public linear_model::training::Batch
90 {
91 public:
92  typedef algorithms::ridge_regression::training::Input InputType;
93  typedef algorithms::ridge_regression::TrainParameter ParameterType;
94  typedef algorithms::ridge_regression::training::Result ResultType;
95 
96  InputType input;
97  ParameterType parameter;
100  Batch()
101  {
102  initialize();
103  }
104 
111  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
112  {
113  initialize();
114  }
115 
116  ~Batch() {}
117 
118  virtual regression::training::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
119 
124  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
125 
130  ResultPtr getResult() { return ResultType::cast(_result); }
131 
138  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
139  {
140  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
141  }
142 
143 protected:
144 
145  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
146  {
147  return new Batch<algorithmFPType, method>(*this);
148  }
149 
150  services::Status allocateResult() DAAL_C11_OVERRIDE
151  {
152  services::Status s = getResult()->template allocate<algorithmFPType>(&input, &parameter, method);
153  _res = _result.get();
154  return s;
155  }
156 
157  void initialize()
158  {
159  _ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
160  _in = &input;
161  _par = &parameter;
162  _result.reset(new ResultType());
163  }
164 };
166 } // namespace interface1
167 
168 using interface1::BatchContainer;
169 using interface1::Batch;
170 
171 } // namespace training
172 } // namespace ridge_regression
173 } // namespace algorithms
174 } // namespace daal
175 
176 #endif
daal::algorithms::ridge_regression::training::interface1::Batch::parameter
ParameterType parameter
Definition: ridge_regression_training_batch.h:97
daal::algorithms::ridge_regression::training::interface1::Batch::input
InputType input
Definition: ridge_regression_training_batch.h:96
daal::algorithms::ridge_regression::training::interface1::Batch
Provides methods for ridge regression model-based training in the batch processing mode...
Definition: ridge_regression_training_batch.h:89
daal
Definition: algorithm_base_common.h:31
daal::algorithms::ridge_regression::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_training_batch.h:124
daal_defines.h
daal::batch
Definition: daal_defines.h:110
daal::algorithms::ridge_regression::training::interface1::Batch::Batch
Batch()
Definition: ridge_regression_training_batch.h:100
daal::algorithms::ridge_regression::training::interface1::BatchContainer
Class containing methods for normal equations ridge regression model-based training using algorithmFP...
Definition: ridge_regression_training_batch.h:52
daal::algorithms::ridge_regression::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: ridge_regression_training_batch.h:138
daal::algorithms::ridge_regression::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: ridge_regression_training_batch.h:111
daal::algorithms::ridge_regression::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: ridge_regression_training_batch.h:130
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.