C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

ridge_regression_predict.h
1 /* file: ridge_regression_predict.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the interface for ridge regression model-based prediction
21 //--
22 */
23 
24 #ifndef __RIDGE_REGRESSION_PREDICT_H__
25 #define __RIDGE_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/ridge_regression/ridge_regression_predict_types.h"
30 #include "algorithms/linear_model/linear_model_predict.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace ridge_regression
37 {
38 namespace prediction
39 {
40 namespace interface1
41 {
67 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
68 class Batch
69 {};
70 
86 template<typename algorithmFPType>
87 class Batch<algorithmFPType, defaultDense> : public linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense>
88 {
89 public:
90  typedef linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense> super;
91 
92  typedef algorithms::ridge_regression::prediction::Input InputType;
93  typedef typename super::ParameterType ParameterType;
94  typedef algorithms::ridge_regression::prediction::Result ResultType;
95 
96  InputType input;
99  Batch()
100  {
101  initialize();
102  }
103 
110  Batch(const Batch<algorithmFPType, defaultDense> &other) : input(other.input)
111  {
112  initialize();
113  }
114 
119  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)defaultDense; }
120 
125  ResultPtr getResult() { return ResultType::cast(this->_result); }
126 
132  services::SharedPtr<Batch<algorithmFPType, defaultDense> > clone() const
133  {
134  return services::SharedPtr<Batch<algorithmFPType, defaultDense> >(cloneImpl());
135  }
136 
137  virtual regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
138 
139 protected:
140 
141  virtual Batch<algorithmFPType, defaultDense> * cloneImpl() const DAAL_C11_OVERRIDE
142  {
143  return new Batch<algorithmFPType, defaultDense>(*this);
144  }
145 
146  services::Status allocateResult() DAAL_C11_OVERRIDE
147  {
148  services::Status s = getResult()->template allocate<algorithmFPType>(this->_in, 0, 0);
149  this->_res = this->_result.get();
150  return s;
151  }
152 
153  void initialize()
154  {
155  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, linear_model::prediction::BatchContainer, algorithmFPType, linear_model::prediction::defaultDense)(&(this->_env));
156  this->_in = &input;
157  this->_par = NULL;
158  this->_result.reset(new ResultType());
159  }
160 };
162 } // namespace interface1
163 using interface1::Batch;
164 
165 } // namespace prediction
166 } // namespace ridge_regression
167 } // namespace algorithms
168 } // namespace daal
169 
170 #endif
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::clone
services::SharedPtr< Batch< algorithmFPType, defaultDense > > clone() const
Definition: ridge_regression_predict.h:132
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch()
Definition: ridge_regression_predict.h:99
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_predict.h:119
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getResult
ResultPtr getResult()
Definition: ridge_regression_predict.h:125
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::input
InputType input
Definition: ridge_regression_predict.h:96
daal::algorithms::ridge_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch(const Batch< algorithmFPType, defaultDense > &other)
Definition: ridge_regression_predict.h:110
daal::algorithms::association_rules::defaultDense
Definition: apriori_types.h:53
daal_defines.h
daal::algorithms::linear_model::prediction::defaultDense
Definition: linear_model_predict_types.h:55
daal::algorithms::ridge_regression::prediction::interface1::Batch
Provides methods to run implementations of the ridge regression model-based prediction.
Definition: ridge_regression_predict.h:68
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:87

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