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

linear_regression_training_types.h
1 /* file: linear_regression_training_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 linear regression algorithm interface
19 //--
20 */
21 
22 #ifndef __LINEAR_REGRESSION_TRAINING_TYPES_H__
23 #define __LINEAR_REGRESSION_TRAINING_TYPES_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "algorithms/linear_regression/linear_regression_model.h"
28 #include "algorithms/linear_model/linear_model_training_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
37 namespace linear_regression
38 {
48 namespace training
49 {
54 enum Method
55 {
56  defaultDense = 0,
57  normEqDense = 0,
58  qrDense = 1
59 };
60 
65 enum InputId
66 {
67  data = linear_model::training::data,
68  dependentVariables = linear_model::training::dependentVariables,
69  lastInputId = dependentVariables
70 };
71 
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::linear_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::linear_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 
281 template<> class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input, public InputIface
282 {
283 public:
284  DistributedInput<step2Master>();
291  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
292 
299  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &ptr);
300 
307  void add(Step2MasterInputId id, const PartialResultPtr &partialResult);
308 
313  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
314 
319  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
320 
327  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
328 };
329 
335 class DAAL_EXPORT Result : public linear_model::training::Result
336 {
337 public:
338  DECLARE_SERIALIZABLE_CAST(Result);
339  Result();
340 
349  template<typename algorithmFPType>
350  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const Parameter *parameter, const int method);
351 
360  template<typename algorithmFPType>
361  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const Parameter *parameter, const int method);
362 
368  linear_regression::ModelPtr get(ResultId id) const;
369 
375  void set(ResultId id, const linear_regression::ModelPtr &value);
376 
385  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
386 
395  services::Status check(const daal::algorithms::PartialResult *pr, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
396 
397 protected:
399  template<typename Archive, bool onDeserialize>
400  services::Status serialImpl(Archive *arch)
401  {
402  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
403  }
404 };
405 typedef services::SharedPtr<Result> ResultPtr;
406 typedef services::SharedPtr<const Result> ResultConstPtr;
407 } // namespace interface1
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 
419 } // namespace training
420 }
424 }
425 } // namespace daal
426 #endif
daal::algorithms::linear_regression::training::ResultId
ResultId
Available identifiers of the result of linear regression model-based training.
Definition: linear_regression_training_types.h:97
daal::algorithms::linear_regression::training::partialModel
Definition: linear_regression_training_types.h:89
daal
Definition: algorithm_base_common.h:31
daal::algorithms::linear_regression::training::data
Definition: linear_regression_training_types.h:67
daal::algorithms::linear_regression::training::PartialResultID
PartialResultID
Available identifiers of a partial result of linear regression model-based training.
Definition: linear_regression_training_types.h:87
daal::algorithms::linear_regression::training::interface1::DistributedInput< step2Master >
Input object for linear regression model-based training in the second step of the distributed process...
Definition: linear_regression_training_types.h:281
daal::algorithms::linear_regression::training::normEqDense
Definition: linear_regression_training_types.h:57
daal::algorithms::linear_regression::training::partialModels
Definition: linear_regression_training_types.h:79
daal::algorithms::linear_regression::training::interface1::DistributedInput
Input object for linear regression model-based training in the distributed processing mode ...
Definition: linear_regression_training_types.h:184
daal::algorithms::linear_regression::training::defaultDense
Definition: linear_regression_training_types.h:56
daal::algorithms::linear_regression::training::interface1::InputIface
Abstract class that specifies the interface of input objects for linear regression model-based traini...
Definition: linear_regression_training_types.h:112
daal::algorithms::linear_regression::training::InputId
InputId
Available identifiers of input objects for linear regression model-based training.
Definition: linear_regression_training_types.h:65
daal::algorithms::linear_regression::training::interface1::Result
Provides methods to access the result obtained with the compute() method of linear regression model-b...
Definition: linear_regression_training_types.h:335
daal::algorithms::linear_regression::training::qrDense
Definition: linear_regression_training_types.h:58
daal::algorithms::linear_model::training::dependentVariables
Definition: linear_model_training_types.h:54
daal::algorithms::linear_regression::training::interface1::InputIface::getNumberOfDependentVariables
virtual size_t getNumberOfDependentVariables() const =0
daal::algorithms::linear_regression::training::model
Definition: linear_regression_training_types.h:99
daal::algorithms::linear_regression::training::dependentVariables
Definition: linear_regression_training_types.h:68
daal::algorithms::linear_model::training::model
Definition: linear_model_training_types.h:64
daal::algorithms::linear_regression::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of linear regression m...
Definition: linear_regression_training_types.h:192
daal::algorithms::linear_model::training::data
Definition: linear_model_training_types.h:53
daal::algorithms::linear_regression::training::interface1::Input
Input objects for linear regression model-based training
Definition: linear_regression_training_types.h:134
daal::algorithms::linear_regression::training::Method
Method
Computation methods for linear regression model-based training.
Definition: linear_regression_training_types.h:54
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::step2Master
Definition: daal_defines.h:118
daal::algorithms::linear_regression::training::interface1::InputIface::getNumberOfFeatures
virtual size_t getNumberOfFeatures() const =0
daal::algorithms::linear_regression::training::Step2MasterInputId
Step2MasterInputId
Available identifiers of input objects for linear regression model-based training in the second step ...
Definition: linear_regression_training_types.h:77

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