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

ridge_regression_training_online.h
1 /* file: ridge_regression_training_online.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 ridge regression model-based training in the online processing mode
45 //--
46 */
47 
48 #ifndef __RIDGE_REGRESSION_TRAINING_ONLINE_H__
49 #define __RIDGE_REGRESSION_TRAINING_ONLINE_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "algorithms/ridge_regression/ridge_regression_training_types.h"
53 #include "algorithms/linear_model/linear_model_training_online.h"
54 
55 namespace daal
56 {
57 namespace algorithms
58 {
59 namespace ridge_regression
60 {
61 namespace training
62 {
63 namespace interface1
64 {
74 template<typename algorithmFPType, Method method, CpuType cpu>
75 class DAAL_EXPORT OnlineContainer : public TrainingContainerIface<online>
76 {
77 public:
82  OnlineContainer(daal::services::Environment::env *daalEnv);
83 
85  ~OnlineContainer();
86 
92  services::Status compute() DAAL_C11_OVERRIDE;
93 
99  services::Status finalizeCompute() DAAL_C11_OVERRIDE;
100 };
101 
120 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = normEqDense>
121 class DAAL_EXPORT Online : public linear_model::training::Online
122 {
123 public:
124  Input input;
125  TrainParameter parameter;
128  Online()
129  {
130  initialize();
131  }
132 
138  Online(const Online<algorithmFPType, method> & other) :
139  linear_model::training::Online(other), input(other.input), parameter(other.parameter)
140  {
141  initialize();
142  }
143 
144  ~Online() {}
145 
146  virtual regression::training::Input* getInput() DAAL_C11_OVERRIDE { return &input; }
147 
152  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
153 
158  PartialResultPtr getPartialResult() { return PartialResult::cast(_partialResult); }
159 
164  ResultPtr getResult() { return Result::cast(_result); }
165 
171  services::SharedPtr<Online<algorithmFPType, method> > clone() const
172  {
173  return services::SharedPtr<Online<algorithmFPType, method> >(cloneImpl());
174  }
175 
176 protected:
177 
178  virtual Online<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
179  {
180  return new Online<algorithmFPType, method>(*this);
181  }
182 
183  services::Status allocateResult() DAAL_C11_OVERRIDE
184  {
185  services::Status s = getResult()->template allocate<algorithmFPType>(&input, &parameter, method);
186  _res = _result.get();
187  return s;
188  }
189 
190  services::Status allocatePartialResult() DAAL_C11_OVERRIDE
191  {
192  services::Status s = getPartialResult()->template allocate<algorithmFPType>(&input, &parameter, method);
193  _pres = _partialResult.get();
194  return s;
195  }
196 
197  services::Status initializePartialResult() DAAL_C11_OVERRIDE
198  {
199  services::Status s = getPartialResult()->template initialize<algorithmFPType>(&input, &parameter, method);
200  _pres = _partialResult.get();
201  return s;
202  }
203 
204  void initialize()
205  {
206  _ac = new __DAAL_ALGORITHM_CONTAINER(online, OnlineContainer, algorithmFPType, method)(&_env);
207  _in = &input;
208  _par = &parameter;
209  _partialResult.reset(new PartialResult());
210  _result.reset(new Result());
211  }
212 }; // class : Online
214 } // namespace interface1
215 
216 using interface1::OnlineContainer;
217 using interface1::Online;
218 
219 } // namespace training
220 } // namespace ridge_regression
221 } // namespace algorithms
222 } // namespace daal
223 
224 #endif
daal::algorithms::ridge_regression::training::interface1::Online::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: ridge_regression_training_online.h:152
daal::algorithms::ridge_regression::training::interface1::Online::getResult
ResultPtr getResult()
Definition: ridge_regression_training_online.h:164
daal::algorithms::ridge_regression::training::interface1::Online::input
Input input
Definition: ridge_regression_training_online.h:124
daal
Definition: algorithm_base_common.h:57
daal::algorithms::ridge_regression::training::interface1::OnlineContainer
Class containing methods for ridge regression model-based training in the online processing mode...
Definition: ridge_regression_training_online.h:75
daal::algorithms::ridge_regression::training::interface1::Online
Provides methods for ridge regression model-based training in the online processing mode...
Definition: ridge_regression_training_online.h:121
daal::algorithms::ridge_regression::training::interface1::Online::Online
Online()
Definition: ridge_regression_training_online.h:128
daal::algorithms::ridge_regression::training::interface1::Online::getPartialResult
PartialResultPtr getPartialResult()
Definition: ridge_regression_training_online.h:158
daal::algorithms::ridge_regression::training::interface1::Online::parameter
TrainParameter parameter
Definition: ridge_regression_training_online.h:125
daal::algorithms::ridge_regression::training::interface1::Online::clone
services::SharedPtr< Online< algorithmFPType, method > > clone() const
Definition: ridge_regression_training_online.h:171
daal::online
Definition: daal_defines.h:133
daal::algorithms::ridge_regression::training::interface1::Online::Online
Online(const Online< algorithmFPType, method > &other)
Definition: ridge_regression_training_online.h:138
daal::algorithms::ridge_regression::training::interface1::Input
Input objects for ridge regression model-based training
Definition: ridge_regression_training_types.h:158
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:76

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