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

saga_types.h
1 /* file: saga_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 Stochastic average gradient descent algorithm types.
19 //--
20 */
21 
22 #ifndef __SAGA_TYPES_H__
23 #define __SAGA_TYPES_H__
24 
25 #include "data_management/data/numeric_table.h"
26 #include "data_management/data/homogen_numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_types.h"
29 #include "algorithms/engines/mt19937/mt19937.h"
30 #include "algorithms/optimization_solver/objective_function/logistic_loss_batch.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace optimization_solver
37 {
47 namespace saga
48 {
49 
54 enum Method
55 {
56  defaultDense = 0,
57 };
58 
63 enum OptionalDataId
64 {
65  gradientsTable = iterative_solver::lastOptionalData + 1,
68  lastOptionalData = gradientsTable
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 {
99  Parameter(
100  const sum_of_functions::interface1::BatchPtr &function,
101  size_t nIterations = 100,
102  double accuracyThreshold = 1.0e-05,
103  const data_management::NumericTablePtr batchIndices = data_management::NumericTablePtr(),
104  const size_t batchSize = 128,
105  const data_management::NumericTablePtr learningRateSequence = data_management::NumericTablePtr(),
106  size_t seed = 777
107  );
108 
109  virtual ~Parameter(){}
110 
116  virtual services::Status check() const DAAL_C11_OVERRIDE;
117 
118  data_management::NumericTablePtr batchIndices;
121  data_management::NumericTablePtr learningRateSequence;
122  size_t seed;
124  engines::EnginePtr engine;
126 };
127 /* [interface1::Parameter source code] */
128 
135 /* [interface1::Input source code] */
136 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::interface1::Input
137 {
138 private:
139  typedef optimization_solver::iterative_solver::interface1::Input super;
140 public:
141  Input();
142  Input(const Input& other);
143 
144  using super::set;
145  using super::get;
146 
152  data_management::NumericTablePtr get(OptionalDataId id) const;
153 
159  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
160 
168  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
169 };
170 /* [interface1::Input source code] */
171 
176 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::interface1::Result
177 {
178 public:
179  DECLARE_SERIALIZABLE_CAST(Result);
180  typedef optimization_solver::iterative_solver::interface1::Result super;
181 
182  Result() {}
183  using super::set;
184  using super::get;
185 
194  template <typename algorithmFPType>
195  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
196 
202  data_management::NumericTablePtr get(OptionalDataId id) const;
203 
209  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
210 
219  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
220  int method) const DAAL_C11_OVERRIDE;
221 };
222 typedef services::SharedPtr<Result> ResultPtr;
223 /* [Result source code] */
224 
226 } // namespace interface1
227 
231 namespace interface2
232 {
233 
240 /* [Parameter source code] */
241 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::Parameter
242 {
256  Parameter(
257  const sum_of_functions::BatchPtr &function,
258  size_t nIterations = 100,
259  double accuracyThreshold = 1.0e-05,
260  const data_management::NumericTablePtr batchIndices = data_management::NumericTablePtr(),
261  const size_t batchSize = 128,
262  const data_management::NumericTablePtr learningRateSequence = data_management::NumericTablePtr(),
263  size_t seed = 777
264  );
265 
266  virtual ~Parameter(){}
267 
273  virtual services::Status check() const DAAL_C11_OVERRIDE;
274 
275  data_management::NumericTablePtr batchIndices;
278  data_management::NumericTablePtr learningRateSequence;
279  size_t seed;
281  engines::EnginePtr engine;
283 };
284 /* [Parameter source code] */
285 
292 /* [Input source code] */
293 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::Input
294 {
295 private:
296  typedef optimization_solver::iterative_solver::Input super;
297 public:
298  Input();
299  Input(const Input& other);
300 
301  using super::set;
302  using super::get;
303 
309  data_management::NumericTablePtr get(OptionalDataId id) const;
310 
316  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
317 
325  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
326 };
327 /* [Input source code] */
328 
333 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::Result
334 {
335 public:
336  DECLARE_SERIALIZABLE_CAST(Result);
337  typedef optimization_solver::iterative_solver::Result super;
338 
339  Result() {}
340  using super::set;
341  using super::get;
342 
351  template <typename algorithmFPType>
352  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
353 
359  data_management::NumericTablePtr get(OptionalDataId id) const;
360 
366  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
367 
376  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
377  int method) const DAAL_C11_OVERRIDE;
378 };
379 typedef services::SharedPtr<Result> ResultPtr;
380 /* [Result source code] */
381 
383 } // namespace interface2
384 
385 using interface2::Parameter;
386 using interface2::Input;
387 using interface2::Result;
388 using interface2::ResultPtr;
389 
390 } // namespace saga
391 } // namespace optimization_solver
392 } // namespace algorithm
393 } // namespace daal
394 #endif
daal::algorithms::optimization_solver::saga::interface1::Input
Input class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:136
daal::algorithms::optimization_solver::saga::interface2::Input
Input class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:293
daal::algorithms::optimization_solver::saga::interface2::Parameter::seed
size_t seed
Definition: saga_types.h:279
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::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::em_gmm::nIterations
Definition: em_gmm_types.h:97
daal::algorithms::optimization_solver::saga::interface2::Parameter::engine
engines::EnginePtr engine
Definition: saga_types.h:281
daal::algorithms::optimization_solver::saga::interface2::Parameter::learningRateSequence
data_management::NumericTablePtr learningRateSequence
Definition: saga_types.h:278
daal::algorithms::optimization_solver::saga::OptionalDataId
OptionalDataId
Definition: saga_types.h:63
daal_defines.h
daal::algorithms::optimization_solver::saga::defaultDense
Definition: saga_types.h:56
daal::algorithms::optimization_solver::saga::interface2::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: saga_types.h:275
daal::algorithms::optimization_solver::saga::interface1::Parameter::learningRateSequence
data_management::NumericTablePtr learningRateSequence
Definition: saga_types.h:121
daal::algorithms::optimization_solver::saga::gradientsTable
Definition: saga_types.h:65
daal::algorithms::optimization_solver::saga::Method
Method
Definition: saga_types.h:54
daal::algorithms::optimization_solver::saga::interface1::Parameter::engine
engines::EnginePtr engine
Definition: saga_types.h:124
daal::algorithms::optimization_solver::saga::interface2::Parameter
Parameter base class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:241
daal::algorithms::optimization_solver::saga::interface1::Parameter::seed
size_t seed
Definition: saga_types.h:122
daal::algorithms::optimization_solver::saga::interface2::Result
Results obtained with the compute() method of the saga algorithm in the batch processing mode...
Definition: saga_types.h:333
daal::algorithms::optimization_solver::saga::interface1::Parameter
Parameter base class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:84
daal::algorithms::optimization_solver::saga::interface1::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: saga_types.h:118
daal::algorithms::optimization_solver::saga::interface1::Result
Results obtained with the compute() method of the saga algorithm in the batch processing mode...
Definition: saga_types.h:176

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