24 #ifndef __ELASTIC_NET_TRAINING_BATCH_H__
25 #define __ELASTIC_NET_TRAINING_BATCH_H__
27 #include "algorithms/algorithm.h"
28 #include "services/daal_defines.h"
29 #include "services/daal_memory.h"
30 #include "algorithms/elastic_net/elastic_net_training_types.h"
31 #include "algorithms/elastic_net/elastic_net_model.h"
32 #include "algorithms/linear_model/linear_model_training_batch.h"
53 template <
typename algorithmFPType, Method method, CpuType cpu>
54 class BatchContainer :
public TrainingContainerIface<batch>
61 BatchContainer(daal::services::Environment::env * daalEnv);
71 services::Status compute() DAAL_C11_OVERRIDE;
89 template <
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
90 class DAAL_EXPORT Batch :
public linear_model::training::Batch
93 typedef algorithms::elastic_net::training::Input InputType;
94 typedef optimization_solver::iterative_solver::BatchPtr SolverPtr;
95 typedef algorithms::elastic_net::training::Parameter ParameterType;
96 typedef algorithms::elastic_net::training::Result ResultType;
101 Batch(
const SolverPtr & solver = SolverPtr());
109 Batch(
const Batch<algorithmFPType, method> & other);
111 ~Batch() {
delete _par; }
117 ParameterType & parameter() {
return *
static_cast<ParameterType *
>(_par); }
123 const ParameterType & parameter()
const {
return *
static_cast<const ParameterType *
>(_par); }
129 virtual regression::training::Input * getInput() DAAL_C11_OVERRIDE {
return &input; }
135 virtual int getMethod() const DAAL_C11_OVERRIDE {
return (
int)method; }
141 ResultPtr getResult() {
return ResultType::cast(_result); }
146 services::Status resetResult() DAAL_C11_OVERRIDE
148 _result.reset(
new ResultType());
149 DAAL_CHECK(_result, services::ErrorNullResult);
151 return services::Status();
160 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const {
return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl()); }
163 virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE {
return new Batch<algorithmFPType, method>(*this); }
165 services::Status allocateResult() DAAL_C11_OVERRIDE
167 services::Status s = getResult()->template allocate<algorithmFPType>(&input,
static_cast<const ParameterType *
>(_par), method);
168 _res = _result.get();
174 _ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
176 _result.reset(
new ResultType());
180 Batch& operator=(
const Batch&);
185 using interface1::BatchContainer;
186 using interface1::Batch;
daal::algorithms::elastic_net::training::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::elastic_net::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: elastic_net_training_batch.h:141
daal::batch
Definition: daal_defines.h:112
daal::algorithms::elastic_net::training::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: elastic_net_training_batch.h:123
daal::algorithms::elastic_net::training::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: elastic_net_training_batch.h:135
daal::algorithms::elastic_net::training::interface1::Batch::resetResult
services::Status resetResult() DAAL_C11_OVERRIDE
Definition: elastic_net_training_batch.h:146
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::elastic_net::training::interface1::BatchContainer
Class containing methods for normal equations elastic net model-based training using algorithmFPType ...
Definition: elastic_net_training_batch.h:54
daal::algorithms::elastic_net::training::interface1::Batch::parameter
ParameterType & parameter()
Definition: elastic_net_training_batch.h:117
daal::algorithms::elastic_net::training::interface1::BatchContainer::~BatchContainer
~BatchContainer()
daal::algorithms::elastic_net::training::interface1::BatchContainer::compute
services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::elastic_net::training::interface1::Batch::input
InputType input
Definition: elastic_net_training_batch.h:98
daal::algorithms::elastic_net::training::interface1::Batch
Provides methods for elastic net model-based training in the batch processing mode.
Definition: elastic_net_training_batch.h:90
daal::algorithms::elastic_net::training::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: elastic_net_training_batch.h:160
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:52
daal::algorithms::elastic_net::training::interface1::Batch::getInput
virtual regression::training::Input * getInput() DAAL_C11_OVERRIDE
Definition: elastic_net_training_batch.h:129