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

linear_regression_group_of_betas_types.h
1 /* file: linear_regression_group_of_betas_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 // Interface for the linear regression algorithm quality metrics for a group of beta coefficients
19 //--
20 */
21 
22 #ifndef __LINEAR_REGRESSION_GROUP_OF_BETAS_TYPES_H__
23 #define __LINEAR_REGRESSION_GROUP_OF_BETAS_TYPES_H__
24 
25 #include "services/daal_shared_ptr.h"
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/homogen_numeric_table.h"
28 
29 namespace daal
30 {
31 namespace algorithms
32 {
33 namespace linear_regression
34 {
35 namespace quality_metric
36 {
43 namespace group_of_betas
44 {
45 
50 enum Method
51 {
52  defaultDense = 0
53 };
54 
59 enum DataInputId
60 {
61  expectedResponses,
62  predictedResponses,
63  predictedReducedModelResponses,
64  lastDataInputId = predictedReducedModelResponses
65 };
66 
71 enum ResultId
72 {
73  expectedMeans,
74  expectedVariance,
75  regSS,
76  resSS,
77  tSS,
78  determinationCoeff,
79  fStatistics,
80  lastResultId = fStatistics
81 };
82 
83 
87 namespace interface1
88 {
89 
96 /* [Parameter source code] */
97 struct DAAL_EXPORT Parameter: public daal::algorithms::Parameter
98 {
99  Parameter(size_t nBeta, size_t nBetaReducedModel) : numBeta(nBeta), numBetaReducedModel(nBetaReducedModel), accuracyThreshold(0.001) {}
100  virtual ~Parameter() {}
101 
102  size_t numBeta;
103  size_t numBetaReducedModel;
104  double accuracyThreshold;
111  virtual services::Status check() const;
112 };
113 /* [Parameter source code] */
114 
119 class DAAL_EXPORT Input: public daal::algorithms::Input
120 {
121 public:
122  DAAL_CAST_OPERATOR(Input);
123  DAAL_DOWN_CAST_OPERATOR(Input, daal::algorithms::Input);
124 
126  Input() : daal::algorithms::Input(lastDataInputId + 1) {}
127 
128  virtual ~Input() {}
129 
135  data_management::NumericTablePtr get(DataInputId id) const
136  {
137  return data_management::NumericTable::cast(Argument::get(id));
138  }
139 
145  void set(DataInputId id, const data_management::NumericTablePtr &value)
146  {
147  Argument::set(id, value);
148  }
149 
157  services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
158 };
159 typedef services::SharedPtr<Input> InputPtr;
160 
165 class DAAL_EXPORT Result: public daal::algorithms::Result
166 {
167 public:
168  DAAL_CAST_OPERATOR(Result);
169  DAAL_DOWN_CAST_OPERATOR(Result, daal::algorithms::Result);
170 
171  Result() : daal::algorithms::Result(lastResultId + 1) {};
172 
178  data_management::NumericTablePtr get(ResultId id) const
179  {
180  return data_management::NumericTable::cast(Argument::get(id));
181  }
182 
188  void set(ResultId id, const data_management::NumericTablePtr &value)
189  {
190  Argument::set(id, value);
191  }
192 
201  template <typename algorithmFPType>
202  services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method)
203  {
204  const data_management::NumericTable *dependentVariableTable = (static_cast<const Input *>(input))->get(expectedResponses).get();
205  const size_t nDepVariable = dependentVariableTable->getNumberOfColumns();
206  services::Status status;
207  for(size_t i = 0; i < (lastResultId + 1); ++i)
208  {
209  Argument::set(i, data_management::HomogenNumericTable<algorithmFPType>::create
210  (nDepVariable, 1, data_management::NumericTableIface::doAllocate, 0, &status));
211  }
212  return status;
213  }
214 
223  services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
224 
228  int getSerializationTag() const DAAL_C11_OVERRIDE { return SERIALIZATION_LINEAR_REGRESSION_GROUP_OF_BETAS_RESULT_ID; }
229 
230 protected:
232  template<typename Archive, bool onDeserialize>
233  services::Status serialImpl(Archive *arch)
234  {
235  daal::algorithms::Result::serialImpl<Archive, onDeserialize>(arch);
236 
237  return services::Status();
238  }
239 
240  services::Status serializeImpl(data_management::InputDataArchive *arch) DAAL_C11_OVERRIDE
241  {
242  serialImpl<data_management::InputDataArchive, false>(arch);
243 
244  return services::Status();
245  }
246 
247  services::Status deserializeImpl(const data_management::OutputDataArchive *arch) DAAL_C11_OVERRIDE
248  {
249  serialImpl<const data_management::OutputDataArchive, true>(arch);
250 
251  return services::Status();
252  }
253 };
254 typedef services::SharedPtr<Result> ResultPtr;
255 
256 }
257 using interface1::Parameter;
258 using interface1::Result;
259 using interface1::Input;
260 using interface1::ResultPtr;
261 using interface1::InputPtr;
262 
263 }
265 }
266 }
267 }
268 }
269 
270 #endif // __LINEAR_REGRESSION_GROUP_OF_BETAS_TYPES_H__
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Input::set
void set(DataInputId id, const data_management::NumericTablePtr &value)
Definition: linear_regression_group_of_betas_types.h:145
daal
Definition: algorithm_base_common.h:31
daal::algorithms::linear_regression::quality_metric::group_of_betas::tSS
Definition: linear_regression_group_of_betas_types.h:77
daal::algorithms::linear_regression::quality_metric::group_of_betas::defaultDense
Definition: linear_regression_group_of_betas_types.h:52
daal::algorithms::linear_regression::quality_metric::group_of_betas::Method
Method
Definition: linear_regression_group_of_betas_types.h:50
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:202
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:165
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:228
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter::numBeta
size_t numBeta
Definition: linear_regression_group_of_betas_types.h:102
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Input::Input
Input()
Definition: linear_regression_group_of_betas_types.h:126
daal::algorithms::linear_regression::quality_metric::group_of_betas::predictedReducedModelResponses
Definition: linear_regression_group_of_betas_types.h:63
daal::algorithms::linear_regression::quality_metric::group_of_betas::expectedMeans
Definition: linear_regression_group_of_betas_types.h:73
daal::algorithms::linear_regression::quality_metric::group_of_betas::expectedVariance
Definition: linear_regression_group_of_betas_types.h:74
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Result::set
void set(ResultId id, const data_management::NumericTablePtr &value)
Definition: linear_regression_group_of_betas_types.h:188
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:59
daal::algorithms::linear_regression::quality_metric::group_of_betas::expectedResponses
Definition: linear_regression_group_of_betas_types.h:61
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter::numBetaReducedModel
size_t numBetaReducedModel
Definition: linear_regression_group_of_betas_types.h:103
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:71
daal::algorithms::math::abs::value
Definition: abs_types.h:86
daal::algorithms::linear_regression::quality_metric::group_of_betas::regSS
Definition: linear_regression_group_of_betas_types.h:75
daal::algorithms::linear_regression::quality_metric::group_of_betas::resSS
Definition: linear_regression_group_of_betas_types.h:76
daal::algorithms::linear_regression::quality_metric::group_of_betas::predictedResponses
Definition: linear_regression_group_of_betas_types.h:62
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:97
daal::algorithms::linear_regression::quality_metric::group_of_betas::fStatistics
Definition: linear_regression_group_of_betas_types.h:79
daal::algorithms::linear_regression::quality_metric::group_of_betas::interface1::Parameter::accuracyThreshold
double accuracyThreshold
Definition: linear_regression_group_of_betas_types.h:104
daal::algorithms::linear_regression::quality_metric::group_of_betas::determinationCoeff
Definition: linear_regression_group_of_betas_types.h:78
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:119

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