C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 4

ridge_regression_training_types.h
1 /* file: ridge_regression_training_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the ridge regression algorithm interface
19 //--
20 */
21 
22 #ifndef __RIDGE_REGRESSION_TRAINING_TYPES_H__
23 #define __RIDGE_REGRESSION_TRAINING_TYPES_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "algorithms/ridge_regression/ridge_regression_model.h"
28 #include "algorithms/linear_model/linear_model_training_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
37 namespace ridge_regression
38 {
48 namespace training
49 {
54 enum Method
55 {
56  defaultDense = 0,
57  normEqDense = 0,
58 };
59 
64 enum InputId
65 {
66  data = linear_model::training::data,
67  dependentVariables = linear_model::training::dependentVariables,
68  lastInputId = dependentVariables
69 };
70 
75 enum Step2MasterInputId
76 {
77  partialModels,
78  lastStep2MasterInputId = partialModels
79 };
80 
85 enum PartialResultID
86 {
87  partialModel,
88  lastPartialResultID = partialModel
89 };
90 
95 enum ResultId
96 {
97  model = linear_model::training::model,
98  lastResultId = model
99 };
100 
104 namespace interface1
105 {
110 class InputIface
111 {
112 public:
117  virtual size_t getNumberOfFeatures() const = 0;
118 
123  virtual size_t getNumberOfDependentVariables() const = 0;
124 
125  virtual ~InputIface() {}
126 };
127 
132 class DAAL_EXPORT Input : public linear_model::training::Input, public InputIface
133 {
134 public:
136  Input();
137  Input(const Input& other);
138 
139  virtual ~Input() {}
140 
146  data_management::NumericTablePtr get(InputId id) const;
147 
153  void set(InputId id, const data_management::NumericTablePtr &value);
154 
159  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
160 
165  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
166 
174  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
175 };
176 
181 template<ComputeStep step>
182 class DistributedInput
183 {};
184 
190 class DAAL_EXPORT PartialResult : public linear_model::training::PartialResult
191 {
192 public:
193  DECLARE_SERIALIZABLE_CAST(PartialResult);
194  PartialResult();
195 
201  daal::algorithms::ridge_regression::ModelPtr get(PartialResultID id) const;
202 
207  size_t getNumberOfFeatures() const;
208 
213  size_t getNumberOfDependentVariables() const;
214 
220  void set(PartialResultID id, const daal::algorithms::ridge_regression::ModelPtr &value);
221 
230  template <typename algorithmFPType>
231  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
232 
241  template <typename algorithmFPType>
242  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
243 
252  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
253 
261  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
262 
263 protected:
265  template<typename Archive, bool onDeserialize>
266  services::Status serialImpl(Archive *arch)
267  {
268  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
269  }
270 };
271 typedef services::SharedPtr<PartialResult> PartialResultPtr;
272 typedef services::SharedPtr<const PartialResult> PartialResultConstPtr;
273 
278 template<> class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input, public InputIface
279 {
280 public:
281  DistributedInput();
282  DistributedInput(const DistributedInput& other);
283 
289  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
290 
296  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &ptr);
297 
303  void add(Step2MasterInputId id, const PartialResultPtr &partialResult);
304 
309  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
310 
315  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
316 
323  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
324 };
325 
326 
332 class DAAL_EXPORT Result : public linear_model::training::Result
333 {
334 public:
335  DECLARE_SERIALIZABLE_CAST(Result);
336  Result();
337 
343  ridge_regression::ModelPtr get(ResultId id) const;
344 
350  void set(ResultId id, const ridge_regression::ModelPtr &value);
351 
360  template<typename algorithmFPType>
361  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const Parameter *parameter, const int method);
362 
371  template<typename algorithmFPType>
372  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const Parameter *parameter, int method);
373 
382  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
383 
392  services::Status check(const daal::algorithms::PartialResult *pr, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
393 
394 protected:
396  template<typename Archive, bool onDeserialize>
397  services::Status serialImpl(Archive *arch)
398  {
399  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
400  }
401 };
402 typedef services::SharedPtr<Result> ResultPtr;
403 typedef services::SharedPtr<const Result> ResultConstPtr;
404 } // namespace interface1
405 
406 using interface1::InputIface;
407 using interface1::Input;
408 using interface1::DistributedInput;
409 using interface1::PartialResult;
410 using interface1::PartialResultPtr;
411 using interface1::PartialResultConstPtr;
412 using interface1::Result;
413 using interface1::ResultPtr;
414 using interface1::ResultConstPtr;
415 
416 } // namespace training
417 } // namespace ridge_regression
419 } // namespace algorithms
420 } // namespace daal
421 
422 #endif
daal::algorithms::ridge_regression::training::model
Definition: ridge_regression_training_types.h:97
daal::algorithms::ridge_regression::training::interface1::InputIface::getNumberOfFeatures
virtual size_t getNumberOfFeatures() const =0
daal
Definition: algorithm_base_common.h:31
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:75
daal::algorithms::ridge_regression::training::ResultId
ResultId
Available identifiers of the result of ridge regression model-based training.
Definition: ridge_regression_training_types.h:95
daal::algorithms::ridge_regression::training::interface1::InputIface::getNumberOfDependentVariables
virtual size_t getNumberOfDependentVariables() const =0
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:110
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:190
daal::algorithms::ridge_regression::training::InputId
InputId
Available identifiers of input objects for ridge regression model-based training. ...
Definition: ridge_regression_training_types.h:64
daal::algorithms::ridge_regression::training::defaultDense
Definition: ridge_regression_training_types.h:56
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:85
daal::algorithms::linear_model::training::dependentVariables
Definition: linear_model_training_types.h:54
daal::algorithms::linear_model::training::model
Definition: linear_model_training_types.h:64
daal::algorithms::linear_model::training::data
Definition: linear_model_training_types.h:53
daal::algorithms::ridge_regression::training::Method
Method
Computation methods for ridge regression model-based training.
Definition: ridge_regression_training_types.h:54
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::algorithms::ridge_regression::training::dependentVariables
Definition: ridge_regression_training_types.h:67
daal::step2Master
Definition: daal_defines.h:122
daal::algorithms::ridge_regression::training::partialModel
Definition: ridge_regression_training_types.h:87
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:332
daal::algorithms::ridge_regression::training::partialModels
Definition: ridge_regression_training_types.h:77
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:182
daal::algorithms::ridge_regression::training::data
Definition: ridge_regression_training_types.h:66
daal::algorithms::ridge_regression::training::normEqDense
Definition: ridge_regression_training_types.h:57
daal::algorithms::ridge_regression::training::interface1::Input
Input objects for ridge regression model-based training
Definition: ridge_regression_training_types.h:132

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