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

ridge_regression_training_types.h
1 /* file: ridge_regression_training_types.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 ridge regression algorithm interface
45 //--
46 */
47 
48 #ifndef __RIDGE_REGRESSION_TRAINING_TYPES_H__
49 #define __RIDGE_REGRESSION_TRAINING_TYPES_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "algorithms/ridge_regression/ridge_regression_model.h"
54 #include "algorithms/linear_model/linear_model_training_types.h"
55 
56 namespace daal
57 {
58 namespace algorithms
59 {
63 namespace ridge_regression
64 {
74 namespace training
75 {
80 enum Method
81 {
82  defaultDense = 0,
83  normEqDense = 0,
84 };
85 
90 enum InputId
91 {
92  data = linear_model::training::data,
93  dependentVariables = linear_model::training::dependentVariables,
94  lastInputId = dependentVariables
95 };
96 
101 enum Step2MasterInputId
102 {
103  partialModels,
104  lastStep2MasterInputId = partialModels
105 };
106 
111 enum PartialResultID
112 {
113  partialModel,
114  lastPartialResultID = partialModel
115 };
116 
121 enum ResultId
122 {
123  model = linear_model::training::model,
124  lastResultId = model
125 };
126 
130 namespace interface1
131 {
136 class InputIface
137 {
138 public:
143  virtual size_t getNumberOfFeatures() const = 0;
144 
149  virtual size_t getNumberOfDependentVariables() const = 0;
150 
151  virtual ~InputIface() {}
152 };
153 
158 class DAAL_EXPORT Input : public linear_model::training::Input, public InputIface
159 {
160 public:
162  Input();
163  Input(const Input& other);
164 
165  virtual ~Input() {}
166 
172  data_management::NumericTablePtr get(InputId id) const;
173 
179  void set(InputId id, const data_management::NumericTablePtr &value);
180 
185  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
186 
191  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
192 
200  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
201 };
202 
207 template<ComputeStep step>
208 class DistributedInput
209 {};
210 
216 class DAAL_EXPORT PartialResult : public linear_model::training::PartialResult
217 {
218 public:
219  DECLARE_SERIALIZABLE_CAST(PartialResult);
220  PartialResult();
221 
227  daal::algorithms::ridge_regression::ModelPtr get(PartialResultID id) const;
228 
233  size_t getNumberOfFeatures() const;
234 
239  size_t getNumberOfDependentVariables() const;
240 
246  void set(PartialResultID id, const daal::algorithms::ridge_regression::ModelPtr &value);
247 
256  template <typename algorithmFPType>
257  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
258 
267  template <typename algorithmFPType>
268  DAAL_EXPORT services::Status initialize(const daal::algorithms::Input *input, const daal::algorithms::Parameter *parameter, const int method);
269 
278  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
279 
287  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
288 
289 protected:
291  template<typename Archive, bool onDeserialize>
292  services::Status serialImpl(Archive *arch)
293  {
294  return daal::algorithms::PartialResult::serialImpl<Archive, onDeserialize>(arch);
295  }
296 };
297 typedef services::SharedPtr<PartialResult> PartialResultPtr;
298 typedef services::SharedPtr<const PartialResult> PartialResultConstPtr;
299 
304 template<> class DAAL_EXPORT DistributedInput<step2Master> : public daal::algorithms::Input, public InputIface
305 {
306 public:
307  DistributedInput();
308  DistributedInput(const DistributedInput& other);
309 
315  data_management::DataCollectionPtr get(Step2MasterInputId id) const;
316 
322  void set(Step2MasterInputId id, const data_management::DataCollectionPtr &ptr);
323 
329  void add(Step2MasterInputId id, const PartialResultPtr &partialResult);
330 
335  size_t getNumberOfFeatures() const DAAL_C11_OVERRIDE;
336 
341  size_t getNumberOfDependentVariables() const DAAL_C11_OVERRIDE;
342 
349  services::Status check(const daal::algorithms::Parameter *parameter, int method) const DAAL_C11_OVERRIDE;
350 };
351 
352 
358 class DAAL_EXPORT Result : public linear_model::training::Result
359 {
360 public:
361  DECLARE_SERIALIZABLE_CAST(Result);
362  Result();
363 
369  ridge_regression::ModelPtr get(ResultId id) const;
370 
376  void set(ResultId id, const ridge_regression::ModelPtr &value);
377 
386  template<typename algorithmFPType>
387  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const Parameter *parameter, const int method);
388 
397  template<typename algorithmFPType>
398  DAAL_EXPORT services::Status allocate(const daal::algorithms::PartialResult *partialResult, const Parameter *parameter, int method);
399 
408  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
409 
418  services::Status check(const daal::algorithms::PartialResult *pr, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
419 
420 protected:
422  template<typename Archive, bool onDeserialize>
423  services::Status serialImpl(Archive *arch)
424  {
425  return daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
426  }
427 };
428 typedef services::SharedPtr<Result> ResultPtr;
429 typedef services::SharedPtr<const Result> ResultConstPtr;
430 } // namespace interface1
431 
432 using interface1::InputIface;
433 using interface1::Input;
434 using interface1::DistributedInput;
435 using interface1::PartialResult;
436 using interface1::PartialResultPtr;
437 using interface1::PartialResultConstPtr;
438 using interface1::Result;
439 using interface1::ResultPtr;
440 using interface1::ResultConstPtr;
441 
442 } // namespace training
443 } // namespace ridge_regression
445 } // namespace algorithms
446 } // namespace daal
447 
448 #endif
daal::algorithms::ridge_regression::training::model
Definition: ridge_regression_training_types.h:123
daal::algorithms::ridge_regression::training::interface1::InputIface::getNumberOfFeatures
virtual size_t getNumberOfFeatures() const =0
daal
Definition: algorithm_base_common.h:57
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:101
daal::algorithms::ridge_regression::training::ResultId
ResultId
Available identifiers of the result of ridge regression model-based training.
Definition: ridge_regression_training_types.h:121
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:136
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:216
daal::algorithms::ridge_regression::training::InputId
InputId
Available identifiers of input objects for ridge regression model-based training. ...
Definition: ridge_regression_training_types.h:90
daal::algorithms::ridge_regression::training::defaultDense
Definition: ridge_regression_training_types.h:82
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:111
daal::algorithms::linear_model::training::dependentVariables
Definition: linear_model_training_types.h:80
daal::algorithms::linear_model::training::model
Definition: linear_model_training_types.h:90
daal::algorithms::linear_model::training::data
Definition: linear_model_training_types.h:79
daal::algorithms::ridge_regression::training::Method
Method
Computation methods for ridge regression model-based training.
Definition: ridge_regression_training_types.h:80
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::algorithms::ridge_regression::training::dependentVariables
Definition: ridge_regression_training_types.h:93
daal::step2Master
Definition: daal_defines.h:143
daal::algorithms::ridge_regression::training::partialModel
Definition: ridge_regression_training_types.h:113
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:358
daal::algorithms::ridge_regression::training::partialModels
Definition: ridge_regression_training_types.h:103
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:208
daal::algorithms::ridge_regression::training::data
Definition: ridge_regression_training_types.h:92
daal::algorithms::ridge_regression::training::normEqDense
Definition: ridge_regression_training_types.h:83
daal::algorithms::ridge_regression::training::interface1::Input
Input objects for ridge regression model-based training
Definition: ridge_regression_training_types.h:158

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