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

ridge_regression_predict.h
1 /* file: ridge_regression_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 ridge regression model-based prediction
19 //--
20 */
21 
22 #ifndef __RIDGE_REGRESSION_PREDICT_H__
23 #define __RIDGE_REGRESSION_PREDICT_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "services/daal_defines.h"
27 #include "algorithms/ridge_regression/ridge_regression_predict_types.h"
28 #include "algorithms/linear_model/linear_model_predict.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace ridge_regression
35 {
36 namespace prediction
37 {
38 namespace interface1
39 {
65 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
66 class Batch
67 {};
68 
84 template<typename algorithmFPType>
85 class Batch<algorithmFPType, defaultDense> : public linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense>
86 {
87 public:
88  typedef linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense> super;
89 
90  typedef algorithms::ridge_regression::prediction::Input InputType;
91  typedef typename super::ParameterType ParameterType;
92  typedef algorithms::ridge_regression::prediction::Result ResultType;
93 
94  InputType input;
97  Batch()
98  {
99  initialize();
100  }
101 
108  Batch(const Batch<algorithmFPType, defaultDense> &other) : input(other.input)
109  {
110  initialize();
111  }
112 
117  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)defaultDense; }
118 
123  ResultPtr getResult() { return ResultType::cast(this->_result); }
124 
130  services::SharedPtr<Batch<algorithmFPType, defaultDense> > clone() const
131  {
132  return services::SharedPtr<Batch<algorithmFPType, defaultDense> >(cloneImpl());
133  }
134 
135  virtual regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
136 
137 protected:
138 
139  virtual Batch<algorithmFPType, defaultDense> * cloneImpl() const DAAL_C11_OVERRIDE
140  {
141  return new Batch<algorithmFPType, defaultDense>(*this);
142  }
143 
144  services::Status allocateResult() DAAL_C11_OVERRIDE
145  {
146  services::Status s = getResult()->template allocate<algorithmFPType>(this->_in, 0, 0);
147  this->_res = this->_result.get();
148  return s;
149  }
150 
151  void initialize()
152  {
153  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, linear_model::prediction::BatchContainer, algorithmFPType, linear_model::prediction::defaultDense)(&(this->_env));
154  this->_in = &input;
155  this->_par = NULL;
156  this->_result.reset(new ResultType());
157  }
158 };
160 } // namespace interface1
161 using interface1::Batch;
162 
163 } // namespace prediction
164 } // namespace ridge_regression
165 } // namespace algorithms
166 } // namespace daal
167 
168 #endif
daal
Definition: algorithm_base_common.h:31
daal::algorithms::association_rules::defaultDense
Definition: apriori_types.h:51
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::clone
services::SharedPtr< Batch< algorithmFPType, defaultDense > > clone() const
Definition: ridge_regression_predict.h:130
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch(const Batch< algorithmFPType, defaultDense > &other)
Definition: ridge_regression_predict.h:108
daal_defines.h
daal::batch
Definition: daal_defines.h:110
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >
Provides methods to run implementations of the ridge regression model-based prediction.
Definition: ridge_regression_predict.h:85
daal::algorithms::ridge_regression::prediction::interface1::Batch
Provides methods to run implementations of the ridge regression model-based prediction.
Definition: ridge_regression_predict.h:66
daal::algorithms::linear_model::prediction::defaultDense
Definition: linear_model_predict_types.h:53
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:76
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::input
InputType input
Definition: ridge_regression_predict.h:94
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch()
Definition: ridge_regression_predict.h:97
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getResult
ResultPtr getResult()
Definition: ridge_regression_predict.h:123
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_predict.h:117

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