C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 5

adagrad_types.h
1 /* file: adagrad_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 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 // Implementation of the Adaptive gradient descent algorithm types.
19 //--
20 */
21 
22 #ifndef __ADAGRAD_TYPES_H__
23 #define __ADAGRAD_TYPES_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "data_management/data/homogen_numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_types.h"
30 #include "algorithms/engines/mt19937/mt19937.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace optimization_solver
37 {
47 namespace adagrad
48 {
49 
54 enum Method
55 {
56  defaultDense = 0,
57 };
58 
63 enum OptionalDataId
64 {
65  gradientSquareSum = iterative_solver::lastOptionalData + 1,
68  lastOptionalData = gradientSquareSum
69 };
70 
74 namespace interface1
75 {
76 
83 /* [interface1::Parameter source code] */
84 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::interface1::Parameter
85 {
100  Parameter(
101  const sum_of_functions::interface1::BatchPtr &function_,
102  size_t nIterations_ = 100,
103  double accuracyThreshold_ = 1.0e-05,
104  data_management::NumericTablePtr batchIndices_ = data_management::NumericTablePtr(),
105  const size_t batchSize_ = 128,
106  data_management::NumericTablePtr learningRate_ = data_management::HomogenNumericTable<double>::create(1, 1, data_management::NumericTableIface::doAllocate, 0.01),
107  double degenerateCasesThreshold_ = 1.0e-08,
108  size_t seed_ = 777
109  );
110 
111  virtual ~Parameter() {}
112 
118  virtual services::Status check() const DAAL_C11_OVERRIDE;
119 
120  data_management::NumericTablePtr batchIndices;
123  data_management::NumericTablePtr learningRate;
124  double degenerateCasesThreshold;
125  size_t seed;
127  engines::EnginePtr engine;
129 };
130 /* [interface1::Parameter source code] */
131 
138 /* [interface1::Input source code] */
139 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::interface1::Input
140 {
141 public:
142  typedef optimization_solver::iterative_solver::interface1::Input super;
143  Input();
144  Input(const Input& other);
145 
146  using super::set;
147  using super::get;
148 
154  data_management::NumericTablePtr get(OptionalDataId id) const;
155 
161  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
162 
170  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
171 };
172 /* [interface1::Input source code] */
173 
178 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::interface1::Result
179 {
180 public:
181  DECLARE_SERIALIZABLE_CAST(Result);
182  typedef optimization_solver::iterative_solver::interface1::Result super;
183 
184  Result() {}
185  using super::set;
186  using super::get;
187 
196  template <typename algorithmFPType>
197  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
198 
204  data_management::NumericTablePtr get(OptionalDataId id) const;
205 
211  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
212 
221  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
222  int method) const DAAL_C11_OVERRIDE;
223 };
224 typedef services::SharedPtr<Result> ResultPtr;
225 /* [Result source code] */
226 
228 } // namespace interface1
229 
233 namespace interface2
234 {
235 
242 /* [Parameter source code] */
243 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::Parameter
244 {
259  Parameter(
260  const sum_of_functions::BatchPtr &function_,
261  size_t nIterations_ = 100,
262  double accuracyThreshold_ = 1.0e-05,
263  data_management::NumericTablePtr batchIndices_ = data_management::NumericTablePtr(),
264  const size_t batchSize_ = 128,
265  data_management::NumericTablePtr learningRate_ = data_management::HomogenNumericTable<double>::create(1, 1, data_management::NumericTableIface::doAllocate, 0.01),
266  double degenerateCasesThreshold_ = 1.0e-08,
267  size_t seed_ = 777
268  );
269 
270  virtual ~Parameter() {}
271 
277  virtual services::Status check() const DAAL_C11_OVERRIDE;
278 
279  data_management::NumericTablePtr batchIndices;
282  data_management::NumericTablePtr learningRate;
283  double degenerateCasesThreshold;
284  size_t seed;
286  engines::EnginePtr engine;
288 };
289 /* [Parameter source code] */
290 
297 /* [Input source code] */
298 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::Input
299 {
300 public:
301  typedef optimization_solver::iterative_solver::Input super;
302  Input();
303  Input(const Input& other);
304 
305  using super::set;
306  using super::get;
307 
313  data_management::NumericTablePtr get(OptionalDataId id) const;
314 
320  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
321 
329  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
330 };
331 /* [Input source code] */
332 
337 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::Result
338 {
339 public:
340  DECLARE_SERIALIZABLE_CAST(Result);
341  typedef optimization_solver::iterative_solver::Result super;
342 
343  Result() {}
344  using super::set;
345  using super::get;
346 
355  template <typename algorithmFPType>
356  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
357 
363  data_management::NumericTablePtr get(OptionalDataId id) const;
364 
370  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
371 
380  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
381  int method) const DAAL_C11_OVERRIDE;
382 };
383 typedef services::SharedPtr<Result> ResultPtr;
384 /* [Result source code] */
385 
387 } // namespace interface2
388 using interface2::Parameter;
389 using interface2::Input;
390 using interface2::Result;
391 using interface2::ResultPtr;
392 
393 } // namespace adagrad
394 } // namespace optimization_solver
395 } // namespace algorithm
396 } // namespace daal
397 #endif
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::engine
engines::EnginePtr engine
Definition: adagrad_types.h:127
daal
Definition: algorithm_base_common.h:31
daal::algorithms::optimization_solver::iterative_solver::interface1::Result
Results obtained with the compute() method of the iterative solver algorithm in the batch processing ...
Definition: iterative_solver_types.h:221
daal::algorithms::optimization_solver::adagrad::interface2::Parameter
Parameter base class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:243
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::degenerateCasesThreshold
double degenerateCasesThreshold
Definition: adagrad_types.h:283
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter
Parameter base class for the iterative solver algorithm
Definition: iterative_solver_types.h:113
daal::algorithms::optimization_solver::iterative_solver::interface1::Input
Input parameters for the iterative solver algorithm
Definition: iterative_solver_types.h:158
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::seed
size_t seed
Definition: adagrad_types.h:125
daal::algorithms::optimization_solver::adagrad::interface1::Result
Results obtained with the compute() method of the adagrad algorithm in the batch processing mode...
Definition: adagrad_types.h:178
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::learningRate
data_management::NumericTablePtr learningRate
Definition: adagrad_types.h:123
daal::algorithms::optimization_solver::adagrad::OptionalDataId
OptionalDataId
Definition: adagrad_types.h:63
daal::algorithms::optimization_solver::adagrad::interface2::Result
Results obtained with the compute() method of the adagrad algorithm in the batch processing mode...
Definition: adagrad_types.h:337
daal_defines.h
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::engine
engines::EnginePtr engine
Definition: adagrad_types.h:286
daal::algorithms::optimization_solver::adagrad::defaultDense
Definition: adagrad_types.h:56
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: adagrad_types.h:120
daal::algorithms::optimization_solver::adagrad::interface1::Input
Input class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:139
daal::algorithms::optimization_solver::adagrad::interface2::Input
Input class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:298
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::degenerateCasesThreshold
double degenerateCasesThreshold
Definition: adagrad_types.h:124
daal::algorithms::optimization_solver::adagrad::gradientSquareSum
Definition: adagrad_types.h:65
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::seed
size_t seed
Definition: adagrad_types.h:284
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: adagrad_types.h:279
daal::algorithms::optimization_solver::adagrad::Method
Method
Definition: adagrad_types.h:54
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::learningRate
data_management::NumericTablePtr learningRate
Definition: adagrad_types.h:282
daal::algorithms::optimization_solver::adagrad::interface1::Parameter
Parameter base class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:84

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