25 #ifndef __NEURAL_NETWORKS_TRAINING_H__
26 #define __NEURAL_NETWORKS_TRAINING_H__
28 #include "algorithms/algorithm.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/neural_networks/neural_networks_types.h"
32 #include "algorithms/neural_networks/neural_networks_training_types.h"
33 #include "algorithms/neural_networks/neural_networks_training_model.h"
34 #include "algorithms/neural_networks/layers/layer.h"
43 namespace neural_networks
59 template<
typename algorithmFPType, Method method, CpuType cpu>
60 class BatchContainer :
public TrainingContainerIface<batch>
69 DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
74 DAAL_DEPRECATED ~BatchContainer();
79 DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE;
83 DAAL_DEPRECATED services::Status setupCompute() DAAL_C11_OVERRIDE;
87 DAAL_DEPRECATED services::Status resetCompute() DAAL_C11_OVERRIDE;
107 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
108 class Batch :
public daal::algorithms::Training<batch>
111 typedef algorithms::neural_networks::training::Input InputType;
112 typedef algorithms::neural_networks::training::Parameter ParameterType;
113 typedef algorithms::neural_networks::training::Result ResultType;
119 DAAL_DEPRECATED Batch(services::SharedPtr<optimization_solver::iterative_solver::Batch > optimizationSolver_) : parameter(optimizationSolver_)
130 Batch(
const Batch<algorithmFPType, method> &other) : parameter(other.parameter), input(other.input)
148 DAAL_DEPRECATED services::Status initialize(
const services::Collection<size_t> &sampleSize,
const training::Topology &topology)
150 ResultPtr result = getResult();
151 if (!result || !result->get(neural_networks::training::model))
153 return services::Status(services::ErrorNullModel);
155 _result->get(neural_networks::training::model)->initialize<algorithmFPType>(sampleSize, topology, parameter);
156 return services::Status();
164 ResultPtr getResult()
176 DAAL_DEPRECATED services::Status setResult(
const ResultPtr& res)
178 DAAL_CHECK(res, services::ErrorNullResult)
180 _res = _result.get();
181 return services::Status();
190 DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
192 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
200 DAAL_DEPRECATED_VIRTUAL
virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int) method; }
203 ParameterType parameter;
211 Training<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
214 _result.reset(
new ResultType());
220 DAAL_DEPRECATED_VIRTUAL
virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
222 return new Batch<algorithmFPType, method>(*this);
228 DAAL_DEPRECATED_VIRTUAL
virtual services::Status allocateResult() DAAL_C11_OVERRIDE
230 services::Status s = _result->allocate<algorithmFPType>(&input, ¶meter, (int) method);
231 _res = _result.get();
240 using interface1::Batch;
241 using interface1::BatchContainer;
daal::batch
Definition: daal_defines.h:112
daal::algorithms::neural_networks::training::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: neural_networks_training.h:130
daal::algorithms::neural_networks::training::interface1::BatchContainer::compute
DAAL_DEPRECATED services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::training::interface1::Batch::~Batch
virtual ~Batch()
Definition: neural_networks_training.h:138
daal::algorithms::neural_networks::training::interface1::Batch::Batch
DAAL_DEPRECATED Batch(services::SharedPtr< optimization_solver::iterative_solver::Batch > optimizationSolver_)
Definition: neural_networks_training.h:119
daal::algorithms::neural_networks::training::interface1::Batch::getResult
ResultPtr getResult()
Definition: neural_networks_training.h:164
daal::algorithms::neural_networks::training::interface1::BatchContainer::setupCompute
DAAL_DEPRECATED services::Status setupCompute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::training::interface1::Batch
Provides methods for neural network model-based training in the batch processing mode.
Definition: neural_networks_training.h:108
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::neural_networks::training::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: neural_networks_training.h:200
daal::algorithms::neural_networks::training::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::neural_networks::training::interface1::Batch::setResult
DAAL_DEPRECATED services::Status setResult(const ResultPtr &res)
Definition: neural_networks_training.h:176
daal::algorithms::neural_networks::training::interface1::Batch::allocateResult
virtual DAAL_DEPRECATED_VIRTUAL services::Status allocateResult() DAAL_C11_OVERRIDE
Definition: neural_networks_training.h:228
daal::services::ErrorNullModel
Definition: error_indexes.h:85
daal::algorithms::Training
Provides methods to train models that depend on the data provided. For example, these methods enable ...
Definition: training.h:62
daal::algorithms::neural_networks::training::interface1::Batch::parameter
ParameterType parameter
Definition: neural_networks_training.h:203
daal::algorithms::neural_networks::training::interface1::Batch::initialize
void initialize()
Definition: neural_networks_training.h:209
daal::algorithms::neural_networks::training::interface1::Batch::cloneImpl
virtual DAAL_DEPRECATED_VIRTUAL Batch< algorithmFPType, method > * cloneImpl() const DAAL_C11_OVERRIDE
Definition: neural_networks_training.h:220
daal::algorithms::neural_networks::training::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: neural_networks_training.h:190
daal::algorithms::neural_networks::training::interface1::Batch::initialize
DAAL_DEPRECATED services::Status initialize(const services::Collection< size_t > &sampleSize, const training::Topology &topology)
Definition: neural_networks_training.h:148
daal::algorithms::neural_networks::training::interface1::BatchContainer::resetCompute
DAAL_DEPRECATED services::Status resetCompute() DAAL_C11_OVERRIDE
daal::algorithms::neural_networks::training::model
Definition: neural_networks_training_result.h:54
daal::algorithms::TrainingContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the model...
Definition: training.h:52
daal::algorithms::neural_networks::training::interface1::BatchContainer::~BatchContainer
DAAL_DEPRECATED ~BatchContainer()
daal::algorithms::neural_networks::training::interface1::Batch::input
InputType input
Definition: neural_networks_training.h:202
daal::algorithms::neural_networks::training::interface1::BatchContainer
Class containing methods to train neural network model using algorithmFPType precision arithmetic...
Definition: neural_networks_training.h:60