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

lasso_regression_predict.h
1 /* file: lasso_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 lasso regression model-based prediction
21 //--
22 */
23 
24 #ifndef __LASSO_REGRESSION_PREDICT_H__
25 #define __LASSO_REGRESSION_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/lasso_regression/lasso_regression_predict_types.h"
30 #include "algorithms/linear_model/linear_model_predict.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace lasso_regression
37 {
38 namespace prediction
39 {
40 namespace interface1
41 {
60 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
61 class Batch : public linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense>
62 {
63 public:
64  typedef linear_model::prediction::Batch<algorithmFPType, linear_model::prediction::defaultDense> super;
65 
66  typedef algorithms::lasso_regression::prediction::Input InputType;
67  typedef typename super::ParameterType ParameterType;
68  typedef algorithms::lasso_regression::prediction::Result ResultType;
69 
70  InputType input;
73  Batch()
74  {
75  initialize();
76  }
77 
84  Batch(const Batch<algorithmFPType, defaultDense> &other) : input(other.input)
85  {
86  initialize();
87  }
88 
93  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)defaultDense; }
94 
99  ResultPtr getResult() { return ResultType::cast(this->_result); }
100 
106  services::SharedPtr<Batch<algorithmFPType, defaultDense> > clone() const
107  {
108  return services::SharedPtr<Batch<algorithmFPType, defaultDense> >(cloneImpl());
109  }
110 
111  virtual regression::prediction::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
112 
113 protected:
114 
115  virtual Batch<algorithmFPType, defaultDense> * cloneImpl() const DAAL_C11_OVERRIDE
116  {
117  return new Batch<algorithmFPType, defaultDense>(*this);
118  }
119 
120  services::Status allocateResult() DAAL_C11_OVERRIDE
121  {
122  services::Status s = getResult()->template allocate<algorithmFPType>(this->_in, 0, 0);
123  this->_res = this->_result.get();
124  return s;
125  }
126 
127  void initialize()
128  {
129  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, linear_model::prediction::BatchContainer, algorithmFPType, linear_model::prediction::defaultDense)(&(this->_env));
130  this->_in = &input;
131  this->_par = NULL;
132  this->_result.reset(new ResultType());
133  }
134 };
136 } // namespace interface1
137 using interface1::Batch;
138 
139 } // namespace prediction
140 } // namespace lasso_regression
141 } // namespace algorithms
142 } // namespace daal
143 
144 #endif
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::lasso_regression::prediction::interface1::Batch::Batch
Batch()
Definition: lasso_regression_predict.h:73
daal::algorithms::lasso_regression::prediction::interface1::Batch::input
InputType input
Definition: lasso_regression_predict.h:70
daal::algorithms::lasso_regression::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, defaultDense > &other)
Definition: lasso_regression_predict.h:84
daal::algorithms::lasso_regression::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: lasso_regression_predict.h:93
daal_defines.h
daal::algorithms::lasso_regression::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, defaultDense > > clone() const
Definition: lasso_regression_predict.h:106
daal::algorithms::linear_model::prediction::defaultDense
Definition: linear_model_predict_types.h:55
daal::algorithms::lasso_regression::prediction::interface1::Batch
Provides methods to run implementations of the lasso regression model-based prediction.
Definition: lasso_regression_predict.h:61
daal::algorithms::lasso_regression::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: lasso_regression_predict.h:99

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