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

linear_model_training_types.h
1 /* file: linear_model_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 regression algorithm interface
45 //--
46 */
47 
48 #ifndef __LINEAR_MODEL_TRAINING_TYPES_H__
49 #define __LINEAR_MODEL_TRAINING_TYPES_H__
50 
51 #include "data_management/data/numeric_table.h"
52 #include "algorithms/algorithm_types.h"
53 #include "algorithms/regression/regression_training_types.h"
54 #include "algorithms/linear_model/linear_model_model.h"
55 
56 namespace daal
57 {
58 namespace algorithms
59 {
60 namespace linear_model
61 {
71 namespace training
72 {
77 enum InputId
78 {
79  data = regression::training::data,
80  dependentVariables = regression::training::dependentVariables,
81  lastInputId = dependentVariables
82 };
83 
88 enum ResultId
89 {
90  model = regression::training::model,
91  lastResultId = model
92 };
93 
97 namespace interface1
98 {
103 class DAAL_EXPORT Input : public regression::training::Input
104 {
105 public:
110  Input(size_t nElements);
111  Input(const Input& other);
112 
113  virtual ~Input() {}
114 
120  data_management::NumericTablePtr get(InputId id) const;
121 
127  void set(InputId id, const data_management::NumericTablePtr &value);
128 };
129 
135 class DAAL_EXPORT PartialResult : public regression::training::PartialResult
136 {
137 public:
138  DAAL_CAST_OPERATOR(PartialResult)
143  PartialResult(size_t nElements = 0);
144 protected:
146  template<typename Archive, bool onDeserialize>
147  services::Status serialImpl(Archive *arch)
148  {
149  regression::training::PartialResult::serialImpl<Archive, onDeserialize>(arch);
150 
151  return services::Status();
152  }
153 
154  services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
155  {
156  serialImpl<data_management::InputDataArchive, false>(arch);
157 
158  return services::Status();
159  }
160 
161  services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
162  {
163  serialImpl<const data_management::OutputDataArchive, true>(arch);
164 
165  return services::Status();
166  }
167 };
168 
174 class DAAL_EXPORT Result : public regression::training::Result
175 {
176 public:
177  DAAL_CAST_OPERATOR(Result)
182  Result(size_t nElements = 0);
183 
189  linear_model::ModelPtr get(ResultId id) const;
190 
196  void set(ResultId id, const linear_model::ModelPtr &value);
197 
206  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
207 
208 protected:
210  template<typename Archive, bool onDeserialize>
211  services::Status serialImpl(Archive *arch)
212  {
213  regression::training::Result::serialImpl<Archive, onDeserialize>(arch);
214 
215  return services::Status();
216  }
217 
218  services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
219  {
220  serialImpl<data_management::InputDataArchive, false>(arch);
221 
222  return services::Status();
223  }
224 
225  services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
226  {
227  serialImpl<const data_management::OutputDataArchive, true>(arch);
228 
229  return services::Status();
230  }
231 };
232 typedef services::SharedPtr<Result> ResultPtr;
233 typedef services::SharedPtr<const Result> ResultConstPtr;
234 typedef services::SharedPtr<PartialResult> PartialResultPtr;
235 typedef services::SharedPtr<const PartialResult> PartialResultConstPtr;
236 }
237 using interface1::Input;
238 using interface1::Result;
239 using interface1::ResultPtr;
240 using interface1::ResultConstPtr;
241 using interface1::PartialResult;
242 using interface1::PartialResultPtr;
243 using interface1::PartialResultConstPtr;
244 }
246 }
247 }
248 }
249 #endif
daal::algorithms::regression::training::interface1::Result
Provides methods to access the result obtained with the compute() method of the regression model-base...
Definition: regression_training_types.h:168
daal::algorithms::regression::training::interface1::Input
Input objects for the regression model-based training
Definition: regression_training_types.h:102
daal::algorithms::linear_model::training::ResultId
ResultId
Available identifiers of the result of regression model-based training.
Definition: linear_model_training_types.h:88
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
Definition: algorithm_base_common.h:57
daal::data_management::interface1::InputDataArchive
Provides methods to create an archive data object (serialized) and access this object.
Definition: data_archive.h:715
daal::algorithms::linear_model::training::model
Definition: linear_model_training_types.h:90
daal::algorithms::linear_model::training::interface1::PartialResult::serializeImpl
services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
Definition: linear_model_training_types.h:154
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::regression::training::dependentVariables
Definition: regression_training_types.h:79
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_model::training::interface1::Result::deserializeImpl
services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
Definition: linear_model_training_types.h:225
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::regression::training::model
Definition: regression_training_types.h:89
daal::data_management::interface1::OutputDataArchive
Provides methods to restore an object from its serialized counterpart and access the restored object...
Definition: data_archive.h:978
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::math::abs::value
Definition: abs_types.h:112
daal::algorithms::regression::training::data
Definition: regression_training_types.h:78
daal::algorithms::regression::training::interface1::PartialResult
Provides methods to access a partial result obtained with the compute() method of the regression mode...
Definition: regression_training_types.h:143
daal::algorithms::linear_model::training::dependentVariables
Definition: linear_model_training_types.h:80
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_model::training::interface1::PartialResult::deserializeImpl
services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
Definition: linear_model_training_types.h:161
daal::algorithms::linear_model::training::InputId
InputId
Available identifiers of input objects for regression model-based training.
Definition: linear_model_training_types.h:77
daal::algorithms::linear_model::training::interface1::Result::serializeImpl
services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
Definition: linear_model_training_types.h:218

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