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

lbfgs_types.h
1 /* file: lbfgs_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 limited memory Broyden-Fletcher-Goldfarb-Shanno
21 // algorithm types.
22 //--
23 */
24 #ifndef __LBFGS_TYPES_H__
25 #define __LBFGS_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 "data_management/data/memory_block.h"
31 #include "services/daal_defines.h"
32 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_batch.h"
33 #include "algorithms/optimization_solver/objective_function/sum_of_functions_batch.h"
34 #include "algorithms/engines/mt19937/mt19937.h"
35 
36 namespace daal
37 {
38 namespace algorithms
39 {
48 namespace optimization_solver
49 {
59 namespace lbfgs
60 {
61 
67 enum Method
68 {
69  defaultDense = 0
70 };
71 
76 enum OptionalDataId
77 {
78  correctionPairs = iterative_solver::lastOptionalData + 1,
81  correctionIndices,
84  averageArgumentLIterations,
88  lastOptionalData = averageArgumentLIterations,
89 };
90 
94 namespace interface1
95 {
96 
103 /* [interface1::Parameter source code] */
104 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::interface1::Parameter
105 {
117  DAAL_DEPRECATED Parameter(sum_of_functions::interface1::BatchPtr function = sum_of_functions::interface1::BatchPtr(),
118  size_t nIterations = 100, double accuracyThreshold = 1.0e-5,
119  size_t batchSize = 10, size_t correctionPairBatchSize_ = 100,
120  size_t m = 10, size_t L = 10, size_t seed = 777);
121 
122  DAAL_DEPRECATED_VIRTUAL virtual ~Parameter() {}
123 
124  size_t m;
127  size_t L;
128  size_t seed;
129  engines::EnginePtr engine;
131  data_management::NumericTablePtr batchIndices;
132 
133  size_t correctionPairBatchSize;
136  data_management::NumericTablePtr correctionPairBatchIndices;
140  data_management::NumericTablePtr stepLengthSequence;
141 
147  DAAL_DEPRECATED_VIRTUAL virtual services::Status check() const DAAL_C11_OVERRIDE;
148 };
149 /* [interface1::Parameter source code] */
150 
157 /* [interface1::Input source code] */
158 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::interface1::Input
159 {
160 public:
161  typedef optimization_solver::iterative_solver::interface1::Input super;
162  DAAL_DEPRECATED Input();
163  DAAL_DEPRECATED Input(const Input& other);
164  using super::set;
165  using super::get;
166 
172  DAAL_DEPRECATED data_management::NumericTablePtr get(OptionalDataId id) const;
173 
179  DAAL_DEPRECATED void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
180 
188  DAAL_DEPRECATED_VIRTUAL virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
189 };
190 /* [interface1::Input source code] */
191 
196 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::interface1::Result
197 {
198 public:
199  DECLARE_SERIALIZABLE_CAST(Result);
200  typedef optimization_solver::iterative_solver::interface1::Result super;
201 
202  DAAL_DEPRECATED Result() {}
203  using super::set;
204  using super::get;
205 
212  template <typename algorithmFPType>
213  DAAL_EXPORT DAAL_DEPRECATED services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
214 
220  DAAL_DEPRECATED data_management::NumericTablePtr get(OptionalDataId id) const;
221 
227  DAAL_DEPRECATED void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
228 
237  DAAL_DEPRECATED_VIRTUAL virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
238  int method) const DAAL_C11_OVERRIDE;
239 };
240 typedef services::SharedPtr<Result> ResultPtr;
241 /* [Result source code] */
242 
244 } // namespace interface1
245 
246 
247 namespace interface2
248 {
249 
256 /* [Parameter source code] */
257 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::Parameter
258 {
270  Parameter(sum_of_functions::BatchPtr function = sum_of_functions::BatchPtr(),
271  size_t nIterations = 100, double accuracyThreshold = 1.0e-5,
272  size_t batchSize = 10, size_t correctionPairBatchSize_ = 100,
273  size_t m = 10, size_t L = 10, size_t seed = 777);
274 
275  virtual ~Parameter() {}
276 
277  size_t m;
280  size_t L;
281  size_t seed;
282  engines::EnginePtr engine;
284  data_management::NumericTablePtr batchIndices;
285 
286  size_t correctionPairBatchSize;
289  data_management::NumericTablePtr correctionPairBatchIndices;
293  data_management::NumericTablePtr stepLengthSequence;
294 
300  virtual services::Status check() const DAAL_C11_OVERRIDE;
301 };
302 /* [Parameter source code] */
303 
310 /* [Input source code] */
311 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::Input
312 {
313 public:
314  typedef optimization_solver::iterative_solver::Input super;
315  Input();
316  Input(const Input& other);
317  using super::set;
318  using super::get;
319 
325  data_management::NumericTablePtr get(OptionalDataId id) const;
326 
332  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
333 
341  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
342 };
343 /* [Input source code] */
344 
349 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::Result
350 {
351 public:
352  DECLARE_SERIALIZABLE_CAST(Result);
353  typedef optimization_solver::iterative_solver::Result super;
354 
355  Result() {}
356  using super::set;
357  using super::get;
358 
365  template <typename algorithmFPType>
366  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
367 
373  data_management::NumericTablePtr get(OptionalDataId id) const;
374 
380  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
381 
390  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
391  int method) const DAAL_C11_OVERRIDE;
392 };
393 typedef services::SharedPtr<Result> ResultPtr;
394 /* [Result source code] */
395 
397 } // namespace interface2
398 using interface2::Parameter;
399 using interface2::Input;
400 using interface2::Result;
401 using interface2::ResultPtr;
402 
403 } // namespace lbfgs
404 } // namespace optimization_solver
405 } // namespace algorithm
406 } // namespace daal
407 #endif
daal::algorithms::optimization_solver::lbfgs::Method
Method
Definition: lbfgs_types.h:67
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::correctionPairBatchIndices
data_management::NumericTablePtr correctionPairBatchIndices
Definition: lbfgs_types.h:136
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::engine
engines::EnginePtr engine
Definition: lbfgs_types.h:129
daal::algorithms::optimization_solver::lbfgs::interface2::Parameter::L
size_t L
Definition: lbfgs_types.h:280
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::L
size_t L
Definition: lbfgs_types.h:127
daal::algorithms::optimization_solver::lbfgs::interface2::Parameter::seed
size_t seed
Definition: lbfgs_types.h:281
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::correctionPairBatchSize
size_t correctionPairBatchSize
Definition: lbfgs_types.h:133
daal::algorithms::optimization_solver::lbfgs::interface2::Parameter::correctionPairBatchSize
size_t correctionPairBatchSize
Definition: lbfgs_types.h:286
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::seed
size_t seed
Definition: lbfgs_types.h:128
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::m
size_t m
Definition: lbfgs_types.h:124
daal::algorithms::optimization_solver::lbfgs::interface2::Parameter::correctionPairBatchIndices
data_management::NumericTablePtr correctionPairBatchIndices
Definition: lbfgs_types.h:289
daal_defines.h
daal::algorithms::optimization_solver::lbfgs::defaultDense
Definition: lbfgs_types.h:69
daal::algorithms::optimization_solver::lbfgs::OptionalDataId
OptionalDataId
Definition: lbfgs_types.h:76
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter::stepLengthSequence
data_management::NumericTablePtr stepLengthSequence
Definition: lbfgs_types.h:140
daal::algorithms::optimization_solver::lbfgs::interface2::Parameter::m
size_t m
Definition: lbfgs_types.h:277
daal::algorithms::optimization_solver::lbfgs::interface2::Parameter::engine
engines::EnginePtr engine
Definition: lbfgs_types.h:282
daal::algorithms::optimization_solver::lbfgs::interface1::Parameter
Parameter class for LBFGS algorithm
Definition: lbfgs_types.h:104
daal::algorithms::optimization_solver::lbfgs::interface1::Input
Input class for LBFGS algorithm
Definition: lbfgs_types.h:158
daal::algorithms::optimization_solver::lbfgs::correctionPairs
Definition: lbfgs_types.h:78
daal::algorithms::optimization_solver::lbfgs::correctionIndices
Definition: lbfgs_types.h:81
daal::algorithms::optimization_solver::lbfgs::averageArgumentLIterations
Definition: lbfgs_types.h:84
daal::algorithms::optimization_solver::lbfgs::interface2::Input
Input class for LBFGS algorithm
Definition: lbfgs_types.h:311
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::lbfgs::interface2::Parameter
Parameter class for LBFGS algorithm
Definition: lbfgs_types.h:257
daal::algorithms::optimization_solver::lbfgs::interface1::Result
Results obtained with the compute() method of the LBFGS algorithm in the batch processing mode...
Definition: lbfgs_types.h:196
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::lbfgs::interface2::Result
Results obtained with the compute() method of the LBFGS algorithm in the batch processing mode...
Definition: lbfgs_types.h:349
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::lbfgs::interface2::Parameter::stepLengthSequence
data_management::NumericTablePtr stepLengthSequence
Definition: lbfgs_types.h:293

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