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

ridge_regression_training_types.h
1 /* file: ridge_regression_training_types.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 ridge regression algorithm interface
21 //--
22 */
23 
24 #ifndef __RIDGE_REGRESSION_TRAINING_TYPES_H__
25 #define __RIDGE_REGRESSION_TRAINING_TYPES_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/numeric_table.h"
29 #include "algorithms/ridge_regression/ridge_regression_model.h"
30 #include "algorithms/linear_model/linear_model_training_types.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
39 namespace ridge_regression
40 {
50 namespace training
51 {
56 enum Method
57 {
58  defaultDense = 0,
59  normEqDense = 0,
60 };
61 
66 enum InputId
67 {
68  data = linear_model::training::data,
69  dependentVariables = linear_model::training::dependentVariables,
70  lastInputId = dependentVariables
71 };
72 
77 enum Step2MasterInputId
78 {
79  partialModels,
80  lastStep2MasterInputId = partialModels
81 };
82 
87 enum PartialResultID
88 {
89  partialModel,
90  lastPartialResultID = partialModel
91 };
92 
97 enum ResultId
98 {
99  model = linear_model::training::model,
100  lastResultId = model
101 };
102 
106 namespace interface1
107 {
112 class InputIface
113 {
114 public:
119  virtual size_t getNumberOfFeatures() const = 0;
120 
125  virtual size_t getNumberOfDependentVariables() const = 0;
126 
127  virtual ~InputIface() {}
128 };
129 
134 class DAAL_EXPORT Input : public linear_model::training::Input, public InputIface
135 {
136 public:
138  Input();
139  Input(const Input& other);
140 
141  virtual ~Input() {}
142 
148  data_management::NumericTablePtr get(InputId id) const;
149 
155  void set(InputId id, const data_management::NumericTablePtr &value);
156 
161  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
162 
167  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
168 
176  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
177 };
178 
183 template<ComputeStep step>
184 class DistributedInput
185 {};
186 
192 class DAAL_EXPORT PartialResult : public linear_model::training::PartialResult
193 {
194 public:
195  DECLARE_SERIALIZABLE_CAST(PartialResult);
196  PartialResult();
197 
203  daal::algorithms::ridge_regression::ModelPtr get(PartialResultID id) const;
204 
209  size_t getNumberOfFeatures() const;
210 
215  size_t getNumberOfDependentVariables() const;
216 
222  void set(PartialResultID id, const daal::algorithms::ridge_regression::ModelPtr &value);
223 
232  template <typename algorithmFPType>
233  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
234 
243  template <typename algorithmFPType>
244  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
245 
254  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
255 
263  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
264 
265 protected:
267  template<typename Archive, bool onDeserialize>
268  services::Status serialImpl(Archive *arch)
269  {
270  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
271  }
272 };
273 typedef services::SharedPtr<PartialResult> PartialResultPtr;
274 typedef services::SharedPtr<const PartialResult> PartialResultConstPtr;
275 
280 template<> class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input, public InputIface
281 {
282 public:
283  DistributedInput();
284  DistributedInput(const DistributedInput& other);
285 
291  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
292 
298  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &ptr);
299 
305  void add(Step2MasterInputId id, const PartialResultPtr &partialResult);
306 
311  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
312 
317  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
318 
325  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
326 };
327 
328 
334 class DAAL_EXPORT Result : public linear_model::training::Result
335 {
336 public:
337  DECLARE_SERIALIZABLE_CAST(Result);
338  Result();
339 
345  ridge_regression::ModelPtr get(ResultId id) const;
346 
352  void set(ResultId id, const ridge_regression::ModelPtr &value);
353 
362  template<typename algorithmFPType>
363  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const Parameter *parameter, const int method);
364 
373  template<typename algorithmFPType>
374  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const Parameter *parameter, int method);
375 
384  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
385 
394  services::Status check(const daal::algorithms::PartialResult *pr, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
395 
396 protected:
398  template<typename Archive, bool onDeserialize>
399  services::Status serialImpl(Archive *arch)
400  {
401  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
402  }
403 };
404 typedef services::SharedPtr<Result> ResultPtr;
405 typedef services::SharedPtr<const Result> ResultConstPtr;
406 } // namespace interface1
407 
408 using interface1::InputIface;
409 using interface1::Input;
410 using interface1::DistributedInput;
411 using interface1::PartialResult;
412 using interface1::PartialResultPtr;
413 using interface1::PartialResultConstPtr;
414 using interface1::Result;
415 using interface1::ResultPtr;
416 using interface1::ResultConstPtr;
417 
418 } // namespace training
419 } // namespace ridge_regression
421 } // namespace algorithms
422 } // namespace daal
423 
424 #endif
daal::algorithms::ridge_regression::training::model
Definition: ridge_regression_training_types.h:99
daal::algorithms::linear_model::training::dependentVariables
Definition: linear_model_training_types.h:56
daal::algorithms::ridge_regression::training::dependentVariables
Definition: ridge_regression_training_types.h:69
daal::algorithms::linear_model::training::data
Definition: linear_model_training_types.h:55
daal::algorithms::ridge_regression::training::defaultDense
Definition: ridge_regression_training_types.h:58
daal::algorithms::ridge_regression::training::interface1::InputIface::getNumberOfDependentVariables
virtual size_t getNumberOfDependentVariables() const =0
daal::algorithms::ridge_regression::training::interface1::Result
Provides methods to access the result obtained with the compute() method of ridge regression model-ba...
Definition: ridge_regression_training_types.h:334
daal::algorithms::ridge_regression::training::Step2MasterInputId
Step2MasterInputId
Available identifiers of input objects for ridge regression model-based training in the second step o...
Definition: ridge_regression_training_types.h:77
daal::step2Master
Definition: daal_defines.h:124
daal::algorithms::linear_model::training::model
Definition: linear_model_training_types.h:66
daal::algorithms::ridge_regression::training::normEqDense
Definition: ridge_regression_training_types.h:59
daal::algorithms::ridge_regression::training::InputId
InputId
Available identifiers of input objects for ridge regression model-based training. ...
Definition: ridge_regression_training_types.h:66
daal::algorithms::ridge_regression::training::interface1::InputIface
Abstract class that specifies the interface of input objects for ridge regression model-based trainin...
Definition: ridge_regression_training_types.h:112
daal::algorithms::ridge_regression::training::ResultId
ResultId
Available identifiers of the result of ridge regression model-based training.
Definition: ridge_regression_training_types.h:97
daal::algorithms::ridge_regression::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of ridge regression mo...
Definition: ridge_regression_training_types.h:192
daal::algorithms::ridge_regression::training::Method
Method
Computation methods for ridge regression model-based training.
Definition: ridge_regression_training_types.h:56
daal::algorithms::ridge_regression::training::partialModel
Definition: ridge_regression_training_types.h:89
daal::algorithms::ridge_regression::training::partialModels
Definition: ridge_regression_training_types.h:79
daal::algorithms::ridge_regression::training::interface1::InputIface::getNumberOfFeatures
virtual size_t getNumberOfFeatures() const =0
daal::algorithms::math::abs::value
Definition: abs_types.h:88
daal::algorithms::ridge_regression::training::interface1::DistributedInput
Input object for ridge regression model-based training in the distributed processing mode ...
Definition: ridge_regression_training_types.h:184
daal::algorithms::ridge_regression::training::data
Definition: ridge_regression_training_types.h:68
daal::algorithms::ridge_regression::training::interface1::Input
Input objects for ridge regression model-based training
Definition: ridge_regression_training_types.h:134
daal::algorithms::ridge_regression::training::PartialResultID
PartialResultID
Available identifiers of a partial result of ridge regression model-based training.
Definition: ridge_regression_training_types.h:87

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