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

adagrad_types.h
1 /* file: adagrad_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the Adaptive gradient descent algorithm types.
21 //--
22 */
23 
24 #ifndef __ADAGRAD_TYPES_H__
25 #define __ADAGRAD_TYPES_H__
26 
27 #include "algorithms/algorithm.h"
28 #include "data_management/data/numeric_table.h"
29 #include "data_management/data/homogen_numeric_table.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_types.h"
32 #include "algorithms/engines/mt19937/mt19937.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
38 namespace optimization_solver
39 {
49 namespace adagrad
50 {
51 
56 enum Method
57 {
58  defaultDense = 0,
59 };
60 
65 enum OptionalDataId
66 {
67  gradientSquareSum = iterative_solver::lastOptionalData + 1,
70  lastOptionalData = gradientSquareSum
71 };
72 
76 namespace interface1
77 {
78 
85 /* [interface1::Parameter source code] */
86 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::interface1::Parameter
87 {
102  DAAL_DEPRECATED Parameter(
103  const sum_of_functions::interface1::BatchPtr &function_,
104  size_t nIterations_ = 100,
105  double accuracyThreshold_ = 1.0e-05,
106  data_management::NumericTablePtr batchIndices_ = data_management::NumericTablePtr(),
107  const size_t batchSize_ = 128,
108  data_management::NumericTablePtr learningRate_ = data_management::HomogenNumericTable<double>::create(1, 1, data_management::NumericTableIface::doAllocate, 0.01),
109  double degenerateCasesThreshold_ = 1.0e-08,
110  size_t seed_ = 777
111  );
112 
113  DAAL_DEPRECATED_VIRTUAL virtual ~Parameter() {}
114 
120  DAAL_DEPRECATED_VIRTUAL virtual services::Status check() const DAAL_C11_OVERRIDE;
121 
122  data_management::NumericTablePtr batchIndices;
125  data_management::NumericTablePtr learningRate;
126  double degenerateCasesThreshold;
127  size_t seed;
129  engines::EnginePtr engine;
131 };
132 /* [interface1::Parameter source code] */
133 
140 /* [interface1::Input source code] */
141 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::interface1::Input
142 {
143 public:
144  typedef optimization_solver::iterative_solver::interface1::Input super;
145  DAAL_DEPRECATED Input();
146  DAAL_DEPRECATED Input(const Input& other);
147 
148  using super::set;
149  using super::get;
150 
156  DAAL_DEPRECATED data_management::NumericTablePtr get(OptionalDataId id) const;
157 
163  DAAL_DEPRECATED void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
164 
172  DAAL_DEPRECATED_VIRTUAL virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
173 };
174 /* [interface1::Input source code] */
175 
180 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::interface1::Result
181 {
182 public:
183  DECLARE_SERIALIZABLE_CAST(Result);
184  typedef optimization_solver::iterative_solver::interface1::Result super;
185 
186  DAAL_DEPRECATED Result() {}
187  using super::set;
188  using super::get;
189 
198  template <typename algorithmFPType>
199  DAAL_EXPORT DAAL_DEPRECATED services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
200 
206  DAAL_DEPRECATED data_management::NumericTablePtr get(OptionalDataId id) const;
207 
213  DAAL_DEPRECATED void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
214 
223  DAAL_DEPRECATED_VIRTUAL virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
224  int method) const DAAL_C11_OVERRIDE;
225 };
226 typedef services::SharedPtr<Result> ResultPtr;
227 /* [Result source code] */
228 
230 } // namespace interface1
231 
235 namespace interface2
236 {
237 
244 /* [Parameter source code] */
245 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::Parameter
246 {
261  Parameter(
262  const sum_of_functions::BatchPtr &function_,
263  size_t nIterations_ = 100,
264  double accuracyThreshold_ = 1.0e-05,
265  data_management::NumericTablePtr batchIndices_ = data_management::NumericTablePtr(),
266  const size_t batchSize_ = 128,
267  data_management::NumericTablePtr learningRate_ = data_management::HomogenNumericTable<double>::create(1, 1, data_management::NumericTableIface::doAllocate, 0.01),
268  double degenerateCasesThreshold_ = 1.0e-08,
269  size_t seed_ = 777
270  );
271 
272  virtual ~Parameter() {}
273 
279  virtual services::Status check() const DAAL_C11_OVERRIDE;
280 
281  data_management::NumericTablePtr batchIndices;
284  data_management::NumericTablePtr learningRate;
285  double degenerateCasesThreshold;
286  size_t seed;
288  engines::EnginePtr engine;
290 };
291 /* [Parameter source code] */
292 
299 /* [Input source code] */
300 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::Input
301 {
302 public:
303  typedef optimization_solver::iterative_solver::Input super;
304  Input();
305  Input(const Input& other);
306 
307  using super::set;
308  using super::get;
309 
315  data_management::NumericTablePtr get(OptionalDataId id) const;
316 
322  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
323 
331  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
332 };
333 /* [Input source code] */
334 
339 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::Result
340 {
341 public:
342  DECLARE_SERIALIZABLE_CAST(Result);
343  typedef optimization_solver::iterative_solver::Result super;
344 
345  Result() {}
346  using super::set;
347  using super::get;
348 
357  template <typename algorithmFPType>
358  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
359 
365  data_management::NumericTablePtr get(OptionalDataId id) const;
366 
372  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
373 
382  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
383  int method) const DAAL_C11_OVERRIDE;
384 };
385 typedef services::SharedPtr<Result> ResultPtr;
386 /* [Result source code] */
387 
389 } // namespace interface2
390 using interface2::Parameter;
391 using interface2::Input;
392 using interface2::Result;
393 using interface2::ResultPtr;
394 
395 } // namespace adagrad
396 } // namespace optimization_solver
397 } // namespace algorithm
398 } // namespace daal
399 #endif
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::learningRate
data_management::NumericTablePtr learningRate
Definition: adagrad_types.h:284
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::seed
size_t seed
Definition: adagrad_types.h:127
daal::algorithms::optimization_solver::adagrad::interface1::Parameter
Parameter base class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:86
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: adagrad_types.h:122
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::degenerateCasesThreshold
double degenerateCasesThreshold
Definition: adagrad_types.h:126
daal::algorithms::optimization_solver::adagrad::gradientSquareSum
Definition: adagrad_types.h:67
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:339
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::learningRate
data_management::NumericTablePtr learningRate
Definition: adagrad_types.h:125
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::engine
engines::EnginePtr engine
Definition: adagrad_types.h:129
daal::algorithms::optimization_solver::adagrad::interface2::Parameter
Parameter base class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:245
daal::algorithms::optimization_solver::adagrad::interface2::Input
Input class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:300
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::engine
engines::EnginePtr engine
Definition: adagrad_types.h:288
daal::algorithms::optimization_solver::adagrad::defaultDense
Definition: adagrad_types.h:58
daal_defines.h
daal::algorithms::optimization_solver::adagrad::OptionalDataId
OptionalDataId
Definition: adagrad_types.h:65
daal::algorithms::optimization_solver::adagrad::Method
Method
Definition: adagrad_types.h:56
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::seed
size_t seed
Definition: adagrad_types.h:286
daal::algorithms::optimization_solver::iterative_solver::interface1::Input
Input parameters for the iterative solver algorithm
Definition: iterative_solver_types.h:160
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::degenerateCasesThreshold
double degenerateCasesThreshold
Definition: adagrad_types.h:285
daal::algorithms::optimization_solver::adagrad::interface2::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: adagrad_types.h:281
daal::algorithms::optimization_solver::adagrad::interface1::Input
Input class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:141
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:223
daal::algorithms::optimization_solver::iterative_solver::interface1::Parameter
Parameter base class for the iterative solver algorithm
Definition: iterative_solver_types.h:115
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:180

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