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

saga_types.h
1 /* file: saga_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 Stochastic average gradient descent algorithm types.
21 //--
22 */
23 
24 #ifndef __SAGA_TYPES_H__
25 #define __SAGA_TYPES_H__
26 
27 #include "data_management/data/numeric_table.h"
28 #include "data_management/data/homogen_numeric_table.h"
29 #include "services/daal_defines.h"
30 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_types.h"
31 #include "algorithms/engines/mt19937/mt19937.h"
32 #include "algorithms/optimization_solver/objective_function/logistic_loss_batch.h"
33 
34 namespace daal
35 {
36 namespace algorithms
37 {
38 namespace optimization_solver
39 {
49 namespace saga
50 {
51 
56 enum Method
57 {
58  defaultDense = 0,
59 };
60 
65 enum OptionalDataId
66 {
67  gradientsTable = iterative_solver::lastOptionalData + 1,
70  lastOptionalData = gradientsTable
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 {
101  DAAL_DEPRECATED Parameter(
102  const sum_of_functions::interface1::BatchPtr &function,
103  size_t nIterations = 100,
104  double accuracyThreshold = 1.0e-05,
105  const data_management::NumericTablePtr batchIndices = data_management::NumericTablePtr(),
106  const size_t batchSize = 128,
107  const data_management::NumericTablePtr learningRateSequence = data_management::NumericTablePtr(),
108  size_t seed = 777
109  );
110 
111  DAAL_DEPRECATED_VIRTUAL virtual ~Parameter(){}
112 
118  DAAL_DEPRECATED_VIRTUAL virtual services::Status check() const DAAL_C11_OVERRIDE;
119 
120  data_management::NumericTablePtr batchIndices;
123  data_management::NumericTablePtr learningRateSequence;
124  size_t seed;
126  engines::EnginePtr engine;
128 };
129 /* [interface1::Parameter source code] */
130 
137 /* [interface1::Input source code] */
138 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::interface1::Input
139 {
140 private:
141  typedef optimization_solver::iterative_solver::interface1::Input super;
142 public:
143  DAAL_DEPRECATED Input();
144  DAAL_DEPRECATED Input(const Input& other);
145 
146  using super::set;
147  using super::get;
148 
154  DAAL_DEPRECATED data_management::NumericTablePtr get(OptionalDataId id) const;
155 
161  DAAL_DEPRECATED void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
162 
170  DAAL_DEPRECATED_VIRTUAL 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  DAAL_DEPRECATED Result() {}
185  using super::set;
186  using super::get;
187 
196  template <typename algorithmFPType>
197  DAAL_EXPORT DAAL_DEPRECATED services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
198 
204  DAAL_DEPRECATED data_management::NumericTablePtr get(OptionalDataId id) const;
205 
211  DAAL_DEPRECATED void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
212 
221  DAAL_DEPRECATED_VIRTUAL 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 {
258  Parameter(
259  const sum_of_functions::BatchPtr &function,
260  size_t nIterations = 100,
261  double accuracyThreshold = 1.0e-05,
262  const data_management::NumericTablePtr batchIndices = data_management::NumericTablePtr(),
263  const size_t batchSize = 128,
264  const data_management::NumericTablePtr learningRateSequence = data_management::NumericTablePtr(),
265  size_t seed = 777
266  );
267 
268  virtual ~Parameter(){}
269 
275  virtual services::Status check() const DAAL_C11_OVERRIDE;
276 
277  data_management::NumericTablePtr batchIndices;
280  data_management::NumericTablePtr learningRateSequence;
281  size_t seed;
283  engines::EnginePtr engine;
285 };
286 /* [Parameter source code] */
287 
294 /* [Input source code] */
295 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::Input
296 {
297 private:
298  typedef optimization_solver::iterative_solver::Input super;
299 public:
300  Input();
301  Input(const Input& other);
302 
303  using super::set;
304  using super::get;
305 
311  data_management::NumericTablePtr get(OptionalDataId id) const;
312 
318  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
319 
327  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
328 };
329 /* [Input source code] */
330 
335 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::Result
336 {
337 public:
338  DECLARE_SERIALIZABLE_CAST(Result);
339  typedef optimization_solver::iterative_solver::Result super;
340 
341  Result() {}
342  using super::set;
343  using super::get;
344 
353  template <typename algorithmFPType>
354  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
355 
361  data_management::NumericTablePtr get(OptionalDataId id) const;
362 
368  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
369 
378  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
379  int method) const DAAL_C11_OVERRIDE;
380 };
381 typedef services::SharedPtr<Result> ResultPtr;
382 /* [Result source code] */
383 
385 } // namespace interface2
386 
387 using interface2::Parameter;
388 using interface2::Input;
389 using interface2::Result;
390 using interface2::ResultPtr;
391 
392 } // namespace saga
393 } // namespace optimization_solver
394 } // namespace algorithm
395 } // namespace daal
396 #endif
daal::algorithms::optimization_solver::saga::interface1::Input
Input class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:138
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:335
daal::algorithms::optimization_solver::saga::interface2::Parameter
Parameter base class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:243
daal::algorithms::optimization_solver::saga::interface2::Input
Input class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:295
daal::algorithms::optimization_solver::saga::interface1::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: saga_types.h:120
daal::algorithms::optimization_solver::saga::defaultDense
Definition: saga_types.h:58
daal::algorithms::optimization_solver::saga::gradientsTable
Definition: saga_types.h:67
daal::algorithms::optimization_solver::saga::interface2::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: saga_types.h:277
daal::algorithms::optimization_solver::saga::interface1::Parameter::seed
size_t seed
Definition: saga_types.h:124
daal_defines.h
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:178
daal::algorithms::optimization_solver::saga::interface1::Parameter::learningRateSequence
data_management::NumericTablePtr learningRateSequence
Definition: saga_types.h:123
daal::algorithms::optimization_solver::saga::interface1::Parameter::engine
engines::EnginePtr engine
Definition: saga_types.h:126
daal::algorithms::optimization_solver::saga::interface2::Parameter::seed
size_t seed
Definition: saga_types.h:281
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::saga::interface2::Parameter::learningRateSequence
data_management::NumericTablePtr learningRateSequence
Definition: saga_types.h:280
daal::algorithms::optimization_solver::saga::Method
Method
Definition: saga_types.h:56
daal::algorithms::optimization_solver::saga::interface2::Parameter::engine
engines::EnginePtr engine
Definition: saga_types.h:283
daal::algorithms::optimization_solver::saga::OptionalDataId
OptionalDataId
Definition: saga_types.h:65
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::em_gmm::nIterations
Definition: em_gmm_types.h:99
daal::algorithms::optimization_solver::saga::interface1::Parameter
Parameter base class for the Stochastic average gradient descent algorithm
Definition: saga_types.h:86

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