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

linear_regression_predict.h
1 /* file: linear_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 linear regression model-based prediction
21 //--
22 */
23 
24 #ifndef __LINEAR_REGRESSION_PREDICT_H__
25 #define __LINEAR_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/linear_regression/linear_regression_predict_types.h"
30 #include "algorithms/linear_model/linear_model_predict.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace linear_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 
87 template<typename algorithmFPType>
88 class Batch<algorithmFPType, defaultDense> : public linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense>
89 {
90 public:
91  typedef algorithms::linear_regression::prediction::Input InputType;
92  typedef algorithms::linear_regression::Parameter ParameterType;
93  typedef algorithms::linear_regression::prediction::Result ResultType;
94 
95  InputType input;
98  Batch()
99  {
100  initialize();
101  }
102 
109  Batch(const Batch<algorithmFPType, defaultDense> &other) : input(other.input)
110  {
111  initialize();
112  }
113 
118  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)defaultDense; }
119 
124  ResultPtr getResult() { return ResultType::cast(this->_result); }
125 
131  services::SharedPtr<Batch<algorithmFPType, defaultDense> > clone() const
132  {
133  return services::SharedPtr<Batch<algorithmFPType, defaultDense> >(cloneImpl());
134  }
135 
136  virtual regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
137 
138 protected:
139 
140  virtual Batch<algorithmFPType, defaultDense> * cloneImpl() const DAAL_C11_OVERRIDE
141  {
142  return new Batch<algorithmFPType, defaultDense>(*this);
143  }
144 
145  services::Status allocateResult() DAAL_C11_OVERRIDE
146  {
147  services::Status s = getResult()->template allocate<algorithmFPType>(this->_in, 0, 0);
148  this->_res = this->_result.get();
149  return s;
150  }
151 
152  void initialize()
153  {
154  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, linear_model::prediction::BatchContainer, algorithmFPType, linear_model::prediction::defaultDense)(&(this->_env));
155  this->_in = &input;
156  this->_par = NULL;
157  this->_result.reset(new ResultType());
158  }
159 };
161 } // namespace interface1
162 using interface1::Batch;
163 
164 }
165 }
166 }
167 }
168 #endif
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch()
Definition: linear_regression_predict.h:98
daal::batch
Definition: daal_defines.h:112
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::clone
services::SharedPtr< Batch< algorithmFPType, defaultDense > > clone() const
Definition: linear_regression_predict.h:131
daal::algorithms::linear_regression::prediction::interface1::Batch
Provides methods to run implementations of the linear regression model-based prediction.
Definition: linear_regression_predict.h:68
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::input
InputType input
Definition: linear_regression_predict.h:95
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getResult
ResultPtr getResult()
Definition: linear_regression_predict.h:124
daal::algorithms::association_rules::defaultDense
Definition: apriori_types.h:53
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: linear_regression_predict.h:118
daal_defines.h
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch(const Batch< algorithmFPType, defaultDense > &other)
Definition: linear_regression_predict.h:109
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >
Provides methods to run implementations of the linear regression model-based prediction.
Definition: linear_regression_predict.h:88
daal::algorithms::linear_model::prediction::defaultDense
Definition: linear_model_predict_types.h:55

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