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

linear_regression_predict.h
1 /* file: linear_regression_predict.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the interface for linear regression model-based prediction
45 //--
46 */
47 
48 #ifndef __LINEAR_REGRESSION_PREDICT_H__
49 #define __LINEAR_REGRESSION_PREDICT_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "services/daal_defines.h"
53 #include "algorithms/linear_regression/linear_regression_predict_types.h"
54 #include "algorithms/linear_model/linear_model_predict.h"
55 
56 namespace daal
57 {
58 namespace algorithms
59 {
60 namespace linear_regression
61 {
62 namespace prediction
63 {
64 namespace interface1
65 {
91 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
92 class Batch
93 {};
94 
111 template<typename algorithmFPType>
112 class Batch<algorithmFPType, defaultDense> : public linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense>
113 {
114 public:
115  Input input;
118  Batch()
119  {
120  initialize();
121  }
122 
129  Batch(const Batch<algorithmFPType, defaultDense> &other) : input(other.input)
130  {
131  initialize();
132  }
133 
138  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)defaultDense; }
139 
144  ResultPtr getResult() { return Result::cast(this->_result); }
145 
151  services::SharedPtr<Batch<algorithmFPType, defaultDense> > clone() const
152  {
153  return services::SharedPtr<Batch<algorithmFPType, defaultDense> >(cloneImpl());
154  }
155 
156  virtual regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
157 
158 protected:
159 
160  virtual Batch<algorithmFPType, defaultDense> * cloneImpl() const DAAL_C11_OVERRIDE
161  {
162  return new Batch<algorithmFPType, defaultDense>(*this);
163  }
164 
165  services::Status allocateResult() DAAL_C11_OVERRIDE
166  {
167  services::Status s = getResult()->template allocate<algorithmFPType>(this->_in, 0, 0);
168  this->_res = this->_result.get();
169  return s;
170  }
171 
172  void initialize()
173  {
174  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, linear_model::prediction::BatchContainer, algorithmFPType, linear_model::prediction::defaultDense)(&(this->_env));
175  this->_in = &input;
176  this->_par = NULL;
177  this->_result.reset(new Result());
178  }
179 };
181 } // namespace interface1
182 using interface1::Batch;
183 
184 }
185 }
186 }
187 }
188 #endif
daal::algorithms::linear_regression::prediction::interface1::Input
Provides an interface for input objects for making linear regression model-based prediction.
Definition: linear_regression_predict_types.h:124
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch()
Definition: linear_regression_predict.h:118
daal
Definition: algorithm_base_common.h:57
daal::algorithms::association_rules::defaultDense
Definition: apriori_types.h:77
daal_defines.h
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::clone
services::SharedPtr< Batch< algorithmFPType, defaultDense > > clone() const
Definition: linear_regression_predict.h:151
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: linear_regression_predict.h:138
daal::batch
Definition: daal_defines.h:131
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::getResult
ResultPtr getResult()
Definition: linear_regression_predict.h:144
daal::algorithms::linear_regression::prediction::interface1::Input::get
data_management::NumericTablePtr get(NumericTableInputId id) const
daal::algorithms::linear_model::prediction::defaultDense
Definition: linear_model_predict_types.h:79
daal::algorithms::classifier::prediction::prediction
Definition: classifier_predict_types.h:102
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::Batch
Batch(const Batch< algorithmFPType, defaultDense > &other)
Definition: linear_regression_predict.h:129
daal::algorithms::linear_regression::prediction::interface1::Batch< algorithmFPType, defaultDense >::input
Input input
Definition: linear_regression_predict.h:115
daal::algorithms::linear_regression::prediction::interface1::Batch
Provides methods to run implementations of the linear regression model-based prediction.
Definition: linear_regression_predict.h:92
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:112

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