23 #ifndef __SAGA_BATCH_H__
24 #define __SAGA_BATCH_H__
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/optimization_solver/iterative_solver/iterative_solver_batch.h"
29 #include "saga_types.h"
35 namespace optimization_solver
54 template<
typename algorithmFPType, Method method, CpuType cpu>
55 class DAAL_EXPORT BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
63 BatchContainer(daal::services::Environment::env *daalEnv);
71 virtual services::Status compute() DAAL_C11_OVERRIDE;
88 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
89 class DAAL_EXPORT Batch :
public iterative_solver::interface1::Batch
92 typedef algorithms::optimization_solver::saga::interface1::Input InputType;
93 typedef algorithms::optimization_solver::saga::interface1::Parameter ParameterType;
94 typedef algorithms::optimization_solver::saga::interface1::Result ResultType;
99 Batch(
const sum_of_functions::interface1::BatchPtr& objectiveFunction = sum_of_functions::interface1::BatchPtr());
107 Batch(
const Batch<algorithmFPType, method> &other);
117 ParameterType& parameter() {
return *
static_cast<ParameterType*
>(_par); }
123 const ParameterType& parameter()
const {
return *
static_cast<const ParameterType*
>(_par); }
129 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int) method; }
135 virtual iterative_solver::interface1::Input * getInput() DAAL_C11_OVERRIDE {
return &input; }
141 virtual iterative_solver::interface1::Parameter * getParameter() DAAL_C11_OVERRIDE {
return ¶meter(); }
148 virtual services::Status createResult() DAAL_C11_OVERRIDE
150 _result = iterative_solver::interface1::ResultPtr(
new ResultType());
152 return services::Status();
160 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
162 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
169 static services::SharedPtr<Batch<algorithmFPType, method> > create();
172 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
174 return new Batch<algorithmFPType, method>(*this);
177 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
179 services::Status s =
static_cast<ResultType*
>(_result.get())->allocate<algorithmFPType>(&input, _par, (
int)method);
180 _res = _result.get();
186 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
188 _result.reset(
new ResultType());
209 template<
typename algorithmFPType, Method method, CpuType cpu>
210 class DAAL_EXPORT BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
218 BatchContainer(daal::services::Environment::env *daalEnv);
226 virtual services::Status compute() DAAL_C11_OVERRIDE;
243 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
244 class DAAL_EXPORT Batch :
public iterative_solver::Batch
247 typedef algorithms::optimization_solver::saga::Input InputType;
248 typedef algorithms::optimization_solver::saga::Parameter ParameterType;
249 typedef algorithms::optimization_solver::saga::Result ResultType;
254 Batch(
const sum_of_functions::BatchPtr& objectiveFunction = sum_of_functions::BatchPtr());
262 Batch(
const Batch<algorithmFPType, method> &other);
272 ParameterType& parameter() {
return *
static_cast<ParameterType*
>(_par); }
278 const ParameterType& parameter()
const {
return *
static_cast<const ParameterType*
>(_par); }
284 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int) method; }
290 virtual iterative_solver::Input * getInput() DAAL_C11_OVERRIDE {
return &input; }
296 virtual iterative_solver::Parameter * getParameter() DAAL_C11_OVERRIDE {
return ¶meter(); }
303 virtual services::Status createResult() DAAL_C11_OVERRIDE
305 _result = iterative_solver::ResultPtr(
new ResultType());
307 return services::Status();
315 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
317 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
324 static services::SharedPtr<Batch<algorithmFPType, method> > create();
327 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
329 return new Batch<algorithmFPType, method>(*this);
332 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
334 services::Status s =
static_cast<ResultType*
>(_result.get())->allocate<algorithmFPType>(&input, _par, (
int)method);
335 _res = _result.get();
341 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
343 _result.reset(
new ResultType());
348 using interface2::BatchContainer;
349 using interface2::Batch;
daal::algorithms::optimization_solver::saga::interface2::BatchContainer
Provides methods to run implementations of the stochastic average gradient descent algorithm...
Definition: saga_batch.h:210
daal::algorithms::optimization_solver::saga::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: saga_batch.h:123
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::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::optimization_solver::saga::interface1::Batch::parameter
ParameterType & parameter()
Definition: saga_batch.h:117
daal::algorithms::optimization_solver::saga::interface2::Batch::parameter
const ParameterType & parameter() const
Definition: saga_batch.h:278
daal::algorithms::optimization_solver::saga::interface2::Batch::getInput
virtual iterative_solver::Input * getInput() DAAL_C11_OVERRIDE
Definition: saga_batch.h:290
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::saga::interface2::Batch::parameter
ParameterType & parameter()
Definition: saga_batch.h:272
daal::algorithms::optimization_solver::saga::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: saga_batch.h:160
daal::batch
Definition: daal_defines.h:110
daal::algorithms::optimization_solver::saga::interface1::Batch::input
InputType input
Definition: saga_batch.h:96
daal::algorithms::optimization_solver::saga::interface2::Batch
Computes Stochastic average gradient descent in the batch processing mode.
Definition: saga_batch.h:244
daal::algorithms::optimization_solver::saga::interface1::Batch
Computes Stochastic average gradient descent in the batch processing mode.
Definition: saga_batch.h:89
daal::algorithms::optimization_solver::saga::interface2::Batch::createResult
virtual services::Status createResult() DAAL_C11_OVERRIDE
Definition: saga_batch.h:303
daal::algorithms::optimization_solver::saga::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: saga_batch.h:284
daal::algorithms::optimization_solver::saga::interface2::Batch::getParameter
virtual iterative_solver::Parameter * getParameter() DAAL_C11_OVERRIDE
Definition: saga_batch.h:296
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::optimization_solver::saga::interface1::Batch::getInput
virtual iterative_solver::interface1::Input * getInput() DAAL_C11_OVERRIDE
Definition: saga_batch.h:135
daal::algorithms::optimization_solver::saga::interface1::BatchContainer
Provides methods to run implementations of the stochastic average gradient descent algorithm...
Definition: saga_batch.h:55
daal::algorithms::optimization_solver::saga::interface2::Batch::input
InputType input
Definition: saga_batch.h:251
daal::algorithms::optimization_solver::iterative_solver::interface1::Batch
Interface for computing the iterative solver in the batch processing mode.
Definition: iterative_solver_batch.h:52
daal::algorithms::optimization_solver::saga::interface1::Batch::createResult
virtual services::Status createResult() DAAL_C11_OVERRIDE
Definition: saga_batch.h:148
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::Batch::getParameter
virtual iterative_solver::interface1::Parameter * getParameter() DAAL_C11_OVERRIDE
Definition: saga_batch.h:141
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
daal::algorithms::optimization_solver::saga::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: saga_batch.h:315
daal::algorithms::optimization_solver::saga::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: saga_batch.h:129
daal::algorithms::kmeans::objectiveFunction
Definition: kmeans_types.h:109