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

adagrad_types.h
1 /* file: adagrad_types.h */
2 /*******************************************************************************
3 * Copyright 2014-2017 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the Adaptive gradient descent algorithm types.
45 //--
46 */
47 
48 #ifndef __ADAGRAD_TYPES_H__
49 #define __ADAGRAD_TYPES_H__
50 
51 #include "algorithms/algorithm.h"
52 #include "data_management/data/numeric_table.h"
53 #include "data_management/data/homogen_numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_types.h"
56 #include "algorithms/engines/mt19937/mt19937.h"
57 
58 namespace daal
59 {
60 namespace algorithms
61 {
62 namespace optimization_solver
63 {
73 namespace adagrad
74 {
75 
80 enum Method
81 {
82  defaultDense = 0,
83 };
84 
89 enum OptionalDataId
90 {
91  gradientSquareSum = iterative_solver::lastOptionalData + 1,
94  lastOptionalData = gradientSquareSum
95 };
96 
100 namespace interface1
101 {
102 
109 /* [Parameter source code] */
110 struct DAAL_EXPORT Parameter : public optimization_solver::iterative_solver::Parameter
111 {
126  Parameter(
127  const sum_of_functions::BatchPtr &function_,
128  size_t nIterations_ = 100,
129  double accuracyThreshold_ = 1.0e-05,
130  data_management::NumericTablePtr batchIndices_ = data_management::NumericTablePtr(),
131  const size_t batchSize_ = 128,
132  data_management::NumericTablePtr learningRate_ = data_management::HomogenNumericTable<double>::create(1, 1, data_management::NumericTableIface::doAllocate, 0.01),
133  double degenerateCasesThreshold_ = 1.0e-08,
134  size_t seed_ = 777
135  );
136 
137  virtual ~Parameter() {}
138 
144  virtual services::Status check() const DAAL_C11_OVERRIDE;
145 
146  data_management::NumericTablePtr batchIndices;
149  data_management::NumericTablePtr learningRate;
150  double degenerateCasesThreshold;
151  size_t seed;
153  engines::EnginePtr engine;
155 };
156 /* [Parameter source code] */
157 
164 /* [Input source code] */
165 class DAAL_EXPORT Input : public optimization_solver::iterative_solver::Input
166 {
167 public:
168  typedef optimization_solver::iterative_solver::Input super;
169  Input();
170  Input(const Input& other);
171 
172  using super::set;
173  using super::get;
174 
180  data_management::NumericTablePtr get(OptionalDataId id) const;
181 
187  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
188 
196  virtual services::Status check(const daal::algorithms::Parameter *par, int method) const DAAL_C11_OVERRIDE;
197 };
198 /* [Input source code] */
199 
204 class DAAL_EXPORT Result : public optimization_solver::iterative_solver::Result
205 {
206 public:
207  DECLARE_SERIALIZABLE_CAST(Result);
208  typedef optimization_solver::iterative_solver::Result super;
209 
210  Result() {}
211  using super::set;
212  using super::get;
213 
222  template <typename algorithmFPType>
223  DAAL_EXPORT services::Status allocate(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par, const int method);
224 
230  data_management::NumericTablePtr get(OptionalDataId id) const;
231 
237  void set(OptionalDataId id, const data_management::NumericTablePtr &ptr);
238 
247  virtual services::Status check(const daal::algorithms::Input *input, const daal::algorithms::Parameter *par,
248  int method) const DAAL_C11_OVERRIDE;
249 };
250 typedef services::SharedPtr<Result> ResultPtr;
251 /* [Result source code] */
252 
254 } // namespace interface1
255 using interface1::Parameter;
256 using interface1::Input;
257 using interface1::Result;
258 using interface1::ResultPtr;
259 
260 } // namespace adagrad
261 } // namespace optimization_solver
262 } // namespace algorithm
263 } // namespace daal
264 #endif
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::engine
engines::EnginePtr engine
Definition: adagrad_types.h:153
daal
Definition: algorithm_base_common.h:57
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::seed
size_t seed
Definition: adagrad_types.h:151
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:204
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::learningRate
data_management::NumericTablePtr learningRate
Definition: adagrad_types.h:149
daal::algorithms::optimization_solver::adagrad::OptionalDataId
OptionalDataId
Definition: adagrad_types.h:89
daal_defines.h
daal::algorithms::optimization_solver::adagrad::defaultDense
Definition: adagrad_types.h:82
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::batchIndices
data_management::NumericTablePtr batchIndices
Definition: adagrad_types.h:146
daal::algorithms::optimization_solver::adagrad::interface1::Input
Input class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:165
daal::algorithms::optimization_solver::adagrad::interface1::Parameter::degenerateCasesThreshold
double degenerateCasesThreshold
Definition: adagrad_types.h:150
daal::algorithms::optimization_solver::adagrad::gradientSquareSum
Definition: adagrad_types.h:91
daal::algorithms::optimization_solver::adagrad::Method
Method
Definition: adagrad_types.h:80
daal::algorithms::optimization_solver::adagrad::interface1::Parameter
Parameter base class for the Adaptive gradient descent algorithm
Definition: adagrad_types.h:110

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