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

elastic_net_predict.h
1 /* file: elastic_net_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 elastic net model-based prediction
21 //--
22 */
23 
24 #ifndef __ELASTIC_NET_PREDICT_H__
25 #define __ELASTIC_NET_PREDICT_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/elastic_net/elastic_net_predict_types.h"
30 #include "algorithms/linear_model/linear_model_predict.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace elastic_net
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::elastic_net::prediction::Input InputType;
67  typedef typename super::ParameterType ParameterType;
68  typedef algorithms::elastic_net::prediction::Result ResultType;
69 
70  InputType input;
73  Batch() { initialize(); }
74 
81  Batch(const Batch<algorithmFPType, defaultDense> & other) : input(other.input) { initialize(); }
82 
87  virtual int getMethod() const DAAL_C11_OVERRIDE { return (int)defaultDense; }
88 
93  ResultPtr getResult() { return ResultType::cast(this->_result); }
94 
100  services::SharedPtr<Batch<algorithmFPType, defaultDense> > clone() const
101  {
102  return services::SharedPtr<Batch<algorithmFPType, defaultDense> >(cloneImpl());
103  }
104 
105  virtual regression::prediction::Input * getInput() DAAL_C11_OVERRIDE { return &input; }
106 
107 protected:
108  virtual Batch<algorithmFPType, defaultDense> * cloneImpl() const DAAL_C11_OVERRIDE { return new Batch<algorithmFPType, defaultDense>(*this); }
109 
110  services::Status allocateResult() DAAL_C11_OVERRIDE
111  {
112  services::Status s = getResult()->template allocate<algorithmFPType>(this->_in, 0, 0);
113  this->_res = this->_result.get();
114  return s;
115  }
116 
117  void initialize()
118  {
119  this->_ac = new __DAAL_ALGORITHM_CONTAINER(batch, linear_model::prediction::BatchContainer, algorithmFPType,
120  linear_model::prediction::defaultDense)(&(this->_env));
121  this->_in = &input;
122  this->_par = NULL;
123  this->_result.reset(new ResultType());
124  }
125 
126 private:
127  Batch& operator=(const Batch&);
128 };
130 } // namespace interface1
131 using interface1::Batch;
132 
133 } // namespace prediction
134 } // namespace elastic_net
135 } // namespace algorithms
136 } // namespace daal
137 
138 #endif
daal::algorithms::elastic_net::prediction::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, defaultDense > > clone() const
Definition: elastic_net_predict.h:100
daal::algorithms::elastic_net::prediction::interface1::Batch::input
InputType input
Definition: elastic_net_predict.h:70
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::prediction::prediction
Definition: neural_networks_prediction_result.h:55
daal::algorithms::elastic_net::prediction::interface1::Batch::Batch
Batch()
Definition: elastic_net_predict.h:73
daal_defines.h
daal::algorithms::elastic_net::prediction::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: elastic_net_predict.h:87
daal::algorithms::linear_model::prediction::defaultDense
Definition: linear_model_predict_types.h:55
daal::algorithms::elastic_net::prediction::interface1::Batch::getResult
ResultPtr getResult()
Definition: elastic_net_predict.h:93
daal::algorithms::elastic_net::prediction::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, defaultDense > &other)
Definition: elastic_net_predict.h:81
daal::algorithms::elastic_net::prediction::interface1::Batch
Provides methods to run implementations of the elastic net model-based prediction.
Definition: elastic_net_predict.h:61

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