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

linear_regression_group_of_betas_types.h
1 /* file: linear_regression_group_of_betas_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 // Interface for the linear regression algorithm quality metrics for a group of beta coefficients
45 //--
46 */
47 
48 #ifndef __LINEAR_REGRESSION_GROUP_OF_BETAS_TYPES_H__
49 #define __LINEAR_REGRESSION_GROUP_OF_BETAS_TYPES_H__
50 
51 #include "services/daal_shared_ptr.h"
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/homogen_numeric_table.h"
54 
55 namespace daal
56 {
57 namespace algorithms
58 {
59 namespace linear_regression
60 {
61 namespace quality_metric
62 {
69 namespace group_of_betas
70 {
71 
76 enum Method
77 {
78  defaultDense = 0
79 };
80 
85 enum DataInputId
86 {
87  expectedResponses,
88  predictedResponses,
89  predictedReducedModelResponses,
90  lastDataInputId = predictedReducedModelResponses
91 };
92 
97 enum ResultId
98 {
99  expectedMeans,
100  expectedVariance,
101  regSS,
102  resSS,
103  tSS,
104  determinationCoeff,
105  fStatistics,
106  lastResultId = fStatistics
107 };
108 
109 
113 namespace interface1
114 {
115 
122 /* [Parameter source code] */
123 struct DAAL_EXPORT Parameter: public daal::algorithms::Parameter
124 {
125  Parameter(size_t nBeta, size_t nBetaReducedModel) : numBeta(nBeta), numBetaReducedModel(nBetaReducedModel), accuracyThreshold(0.001) {}
126  virtual ~Parameter() {}
127 
128  size_t numBeta;
129  size_t numBetaReducedModel;
130  double accuracyThreshold;
137  virtual services::Status check() const;
138 };
139 /* [Parameter source code] */
140 
145 class DAAL_EXPORT Input: public daal::algorithms::Input
146 {
147 public:
148  DAAL_CAST_OPERATOR(Input);
149  DAAL_DOWN_CAST_OPERATOR(Input, daal::algorithms::Input);
150 
152  Input() : daal::algorithms::Input(lastDataInputId + 1) {}
153 
154  virtual ~Input() {}
155 
161  data_management::NumericTablePtr get(DataInputId id) const
162  {
163  return data_management::NumericTable::cast(Argument::get(id));
164  }
165 
171  void set(DataInputId id, const data_management::NumericTablePtr &value)
172  {
173  Argument::set(id, value);
174  }
175 
183  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
184 };
185 typedef services::SharedPtr<Input> InputPtr;
186 
191 class DAAL_EXPORT Result: public daal::algorithms::Result
192 {
193 public:
194  DAAL_CAST_OPERATOR(Result);
195  DAAL_DOWN_CAST_OPERATOR(Result, daal::algorithms::Result);
196 
197  Result() : daal::algorithms::Result(lastResultId + 1) {};
198 
204  data_management::NumericTablePtr get(ResultId id) const
205  {
206  return data_management::NumericTable::cast(Argument::get(id));
207  }
208 
214  void set(ResultId id, const data_management::NumericTablePtr &value)
215  {
216  Argument::set(id, value);
217  }
218 
227  template <typename algorithmFPType>
228  services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method)
229  {
230  const data_management::NumericTable *dependentVariableTable = (static_cast<const Input *>(input))->get(expectedResponses).get();
231  const size_t nDepVariable = dependentVariableTable->getNumberOfColumns();
232  services::Status status;
233  for(size_t i = 0; i < (lastResultId + 1); ++i)
234  {
235  Argument::set(i, data_management::HomogenNumericTable<algorithmFPType>::create
236  (nDepVariable, 1, data_management::NumericTableIface::doAllocate, 0, &status));
237  }
238  return status;
239  }
240 
249  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
250 
254  int getSerializationTag() const DAAL_C11_OVERRIDE { return SERIALIZATION_LINEAR_REGRESSION_GROUP_OF_BETAS_RESULT_ID; }
255 
256 protected:
258  template<typename Archive, bool onDeserialize>
259  services::Status serialImpl(Archive *arch)
260  {
261  daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
262 
263  return services::Status();
264  }
265 
266  services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
267  {
268  serialImpl<data_management::InputDataArchive, false>(arch);
269 
270  return services::Status();
271  }
272 
273  services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
274  {
275  serialImpl<const data_management::OutputDataArchive, true>(arch);
276 
277  return services::Status();
278  }
279 };
280 typedef services::SharedPtr<Result> ResultPtr;
281 
282 }
283 using interface1::Parameter;
284 using interface1::Result;
285 using interface1::Input;
286 using interface1::ResultPtr;
287 using interface1::InputPtr;
288 
289 }
291 }
292 }
293 }
294 }
295 
296 #endif // __LINEAR_REGRESSION_GROUP_OF_BETAS_TYPES_H__
daal::algorithms::linear_regression::quality_metric::group_of_betas::defaultDense
Definition: linear_regression_group_of_betas_types.h:78
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Result::deserializeImpl
services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
Definition: linear_regression_group_of_betas_types.h:273
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::algorithms::interface1::Result
Base class to represent final results of the computation. Algorithm-specific final results are repres...
Definition: algorithm_types.h:331
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_regression::quality_metric::group_of_betas::expectedResponses
Definition: linear_regression_group_of_betas_types.h:87
daal::algorithms::linear_regression::quality_metric::group_of_betas::expectedVariance
Definition: linear_regression_group_of_betas_types.h:100
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Result::allocate
services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method)
Definition: linear_regression_group_of_betas_types.h:228
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Result
Provides interface for the result of linear regression quality metrics.
Definition: linear_regression_group_of_betas_types.h:191
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Result::serializeImpl
services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
Definition: linear_regression_group_of_betas_types.h:266
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Result::getSerializationTag
int getSerializationTag() const DAAL_C11_OVERRIDE
Definition: linear_regression_group_of_betas_types.h:254
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter::numBeta
size_t numBeta
Definition: linear_regression_group_of_betas_types.h:128
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Input::Input
Input()
Definition: linear_regression_group_of_betas_types.h:152
daal::algorithms::linear_regression::quality_metric::group_of_betas::resSS
Definition: linear_regression_group_of_betas_types.h:102
daal::algorithms::linear_regression::quality_metric::group_of_betas::regSS
Definition: linear_regression_group_of_betas_types.h:101
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_regression::quality_metric::group_of_betas::Method
Method
Definition: linear_regression_group_of_betas_types.h:76
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::data_management::interface1::NumericTable
Class for a data management component responsible for representation of data in the numeric format...
Definition: numeric_table.h:600
daal::algorithms::linear_regression::quality_metric::group_of_betas::tSS
Definition: linear_regression_group_of_betas_types.h:103
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_regression::quality_metric::group_of_betas::determinationCoeff
Definition: linear_regression_group_of_betas_types.h:104
daal::algorithms::linear_regression::quality_metric::group_of_betas::ResultId
ResultId
Available identifiers of the result of a group of betas quality metrics.
Definition: linear_regression_group_of_betas_types.h:97
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter::numBetaReducedModel
size_t numBetaReducedModel
Definition: linear_regression_group_of_betas_types.h:129
daal::algorithms::linear_regression::quality_metric::group_of_betas::expectedMeans
Definition: linear_regression_group_of_betas_types.h:99
daal::algorithms::linear_regression::quality_metric::group_of_betas::DataInputId
DataInputId
Available identifiers of input objects for a group of betas quality metrics.
Definition: linear_regression_group_of_betas_types.h:85
daal::data_management::interface1::NumericTableIface::doAllocate
Definition: numeric_table.h:313
daal::algorithms::math::abs::value
Definition: abs_types.h:112
daal::data_management::interface1::NumericTable::getNumberOfColumns
size_t getNumberOfColumns() const
Definition: numeric_table.h:677
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter
Parameters for the compute() method of a group of betas quality metrics.
Definition: linear_regression_group_of_betas_types.h:123
daal::algorithms::linear_regression::quality_metric::group_of_betas::predictedReducedModelResponses
Definition: linear_regression_group_of_betas_types.h:89
daal::algorithms::interface1::Argument::get
const data_management::SerializationIfacePtr & get(size_t index) const
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: linear_regression_group_of_betas_types.h:130
daal::algorithms::interface1::Input
Base class to represent computation input arguments. Algorithm-specific input arguments are represent...
Definition: algorithm_types.h:217
daal::data_management::interface1::HomogenNumericTable
Class that provides methods to access data stored as a contiguous array of homogeneous feature vector...
Definition: homogen_numeric_table.h:76
daal::algorithms::linear_regression::quality_metric::group_of_betas::predictedResponses
Definition: linear_regression_group_of_betas_types.h:88
daal::algorithms::interface1::Argument::set
void set(size_t index, const data_management::SerializationIfacePtr &value)
daal::algorithms::linear_regression::quality_metric::group_of_betas::fStatistics
Definition: linear_regression_group_of_betas_types.h:105
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Input
Input objects for a group of betas quality metrics
Definition: linear_regression_group_of_betas_types.h:145

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