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

linear_regression_training_types.h
1 /* file: linear_regression_training_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 linear regression algorithm interface
45 //--
46 */
47 
48 #ifndef __LINEAR_REGRESSION_TRAINING_TYPES_H__
49 #define __LINEAR_REGRESSION_TRAINING_TYPES_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "algorithms/linear_regression/linear_regression_model.h"
54 #include "algorithms/linear_model/linear_model_training_types.h"
55 
56 namespace daal
57 {
58 namespace algorithms
59 {
63 namespace linear_regression
64 {
74 namespace training
75 {
80 enum Method
81 {
82  defaultDense = 0,
83  normEqDense = 0,
84  qrDense = 1
85 };
86 
91 enum InputId
92 {
93  data = linear_model::training::data,
94  dependentVariables = linear_model::training::dependentVariables,
95  lastInputId = dependentVariables
96 };
97 
103 enum Step2MasterInputId
104 {
105  partialModels,
106  lastStep2MasterInputId = partialModels
107 };
108 
113 enum PartialResultID
114 {
115  partialModel,
116  lastPartialResultID = partialModel
117 };
118 
123 enum ResultId
124 {
125  model = linear_model::training::model,
126  lastResultId = model
127 };
128 
132 namespace interface1
133 {
138 class InputIface
139 {
140 public:
145  virtual size_t getNumberOfFeatures() const = 0;
146 
151  virtual size_t getNumberOfDependentVariables() const = 0;
152 
153  virtual ~InputIface() {}
154 };
155 
160 class DAAL_EXPORT Input : public linear_model::training::Input, public InputIface
161 {
162 public:
164  Input();
165  Input(const Input& other);
166 
167  virtual ~Input() {}
168 
174  data_management::NumericTablePtr get(InputId id) const;
175 
181  void set(InputId id, const data_management::NumericTablePtr &value);
182 
187  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
188 
193  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
194 
202  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
203 };
204 
209 template<ComputeStep step>
210 class DistributedInput
211 {};
212 
218 class DAAL_EXPORT PartialResult : public linear_model::training::PartialResult
219 {
220 public:
221  DECLARE_SERIALIZABLE_CAST(PartialResult);
222  PartialResult();
223 
229  daal::algorithms::linear_regression::ModelPtr get(PartialResultID id) const;
230 
235  size_t getNumberOfFeatures() const;
236 
241  size_t getNumberOfDependentVariables() const;
242 
248  void set(PartialResultID id, const daal::algorithms::linear_regression::ModelPtr &value);
249 
258  template <typename algorithmFPType>
259  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
260 
269  template <typename algorithmFPType>
270  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
271 
280  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
281 
289  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
290 
291 protected:
293  template<typename Archive, bool onDeserialize>
294  services::Status serialImpl(Archive *arch)
295  {
296  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
297  }
298 };
299 typedef services::SharedPtr<PartialResult> PartialResultPtr;
300 typedef services::SharedPtr<const PartialResult> PartialResultConstPtr;
301 
307 template<> class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input, public InputIface
308 {
309 public:
310  DistributedInput<step2Master>();
317  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
318 
325  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &ptr);
326 
333  void add(Step2MasterInputId id, const PartialResultPtr &partialResult);
334 
339  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
340 
345  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
346 
353  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
354 };
355 
361 class DAAL_EXPORT Result : public linear_model::training::Result
362 {
363 public:
364  DECLARE_SERIALIZABLE_CAST(Result);
365  Result();
366 
375  template<typename algorithmFPType>
376  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const Parameter *parameter, const int method);
377 
386  template<typename algorithmFPType>
387  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const Parameter *parameter, const int method);
388 
394  linear_regression::ModelPtr get(ResultId id) const;
395 
401  void set(ResultId id, const linear_regression::ModelPtr &value);
402 
411  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
412 
421  services::Status check(const daal::algorithms::PartialResult *pr, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
422 
423 protected:
425  template<typename Archive, bool onDeserialize>
426  services::Status serialImpl(Archive *arch)
427  {
428  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
429  }
430 };
431 typedef services::SharedPtr<Result> ResultPtr;
432 typedef services::SharedPtr<const Result> ResultConstPtr;
433 } // namespace interface1
434 using interface1::InputIface;
435 using interface1::Input;
436 using interface1::DistributedInput;
437 using interface1::PartialResult;
438 using interface1::PartialResultPtr;
439 using interface1::PartialResultConstPtr;
440 using interface1::Result;
441 using interface1::ResultPtr;
442 using interface1::ResultConstPtr;
443 
445 } // namespace training
446 }
450 }
451 } // namespace daal
452 #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:123
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal::algorithms::linear_regression::training::partialModel
Definition: linear_regression_training_types.h:115
daal
Definition: algorithm_base_common.h:57
daal::algorithms::linear_regression::training::data
Definition: linear_regression_training_types.h:93
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:113
daal::algorithms::linear_model::training::model
Definition: linear_model_training_types.h:90
daal::algorithms::interface1::PartialResult
Base class to represent partial results of the computation. Algorithm-specific partial results are re...
Definition: algorithm_types.h:253
daal::algorithms::linear_model::training::interface1::Result
Provides methods to access the result obtained with the compute() method of the regression model-base...
Definition: linear_model_training_types.h:174
daal::algorithms::linear_model::training::interface1::Input
Input objects for the regression model-based training
Definition: linear_model_training_types.h:103
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:307
daal::algorithms::linear_regression::training::normEqDense
Definition: linear_regression_training_types.h:83
daal::algorithms::linear_regression::training::partialModels
Definition: linear_regression_training_types.h:105
daal::algorithms::interface1::Parameter
Base class to represent computation parameters. Algorithm-specific parameters are represented as deri...
Definition: algorithm_types.h:86
daal::algorithms::linear_model::training::data
Definition: linear_model_training_types.h:79
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
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:210
daal::algorithms::linear_regression::training::defaultDense
Definition: linear_regression_training_types.h:82
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:138
daal::algorithms::linear_regression::training::InputId
InputId
Available identifiers of input objects for linear regression model-based training.
Definition: linear_regression_training_types.h:91
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:361
daal::algorithms::linear_regression::training::qrDense
Definition: linear_regression_training_types.h:84
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:125
daal::algorithms::linear_regression::training::dependentVariables
Definition: linear_regression_training_types.h:94
daal::algorithms::linear_model::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of the linear model-ba...
Definition: linear_model_training_types.h:135
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:218
daal::algorithms::linear_regression::training::interface1::Input
Input objects for linear regression model-based training
Definition: linear_regression_training_types.h:160
daal::algorithms::linear_regression::training::Method
Method
Computation methods for linear regression model-based training.
Definition: linear_regression_training_types.h:80
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::linear_regression::interface1::Parameter
Parameters for the linear regression algorithm.
Definition: linear_regression_model.h:82
daal::step2Master
Definition: daal_defines.h:144
daal::algorithms::linear_model::training::dependentVariables
Definition: linear_model_training_types.h:80
daal::algorithms::linear_regression::training::interface1::InputIface::getNumberOfFeatures
virtual size_t getNumberOfFeatures() const =0
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
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:103

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