23 #ifndef __CROSS_ENTROPY_BATCH_H__
24 #define __CROSS_ENTROPY_BATCH_H__
26 #include "algorithms/algorithm.h"
27 #include "data_management/data/numeric_table.h"
28 #include "services/daal_defines.h"
29 #include "sum_of_functions_batch.h"
30 #include "cross_entropy_loss_types.h"
36 namespace optimization_solver
38 namespace cross_entropy_loss
57 template<
typename algorithmFPType, Method method, CpuType cpu>
58 class DAAL_EXPORT BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
66 BatchContainer(daal::services::Environment::env *daalEnv);
68 virtual ~BatchContainer();
74 virtual services::Status compute() DAAL_C11_OVERRIDE;
93 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
94 class DAAL_EXPORT Batch :
public sum_of_functions::interface1::Batch
97 typedef sum_of_functions::interface1::Batch super;
99 typedef algorithms::optimization_solver::cross_entropy_loss::interface1::Input InputType;
100 typedef algorithms::optimization_solver::cross_entropy_loss::interface1::Parameter ParameterType;
101 typedef typename super::ResultType ResultType;
106 Batch(
size_t nClasses,
size_t numberOfTerms) : sum_of_functions::interface1::Batch(numberOfTerms, &input, new ParameterType(nClasses, numberOfTerms))
119 Batch(
const Batch<algorithmFPType, method> &other) :
120 sum_of_functions::interface1::Batch(other.parameter().numberOfTerms, &input, new ParameterType(other.parameter())), input(other.input)
129 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
136 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
138 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
146 services::Status allocate()
148 return allocateResult();
155 ParameterType& parameter() {
return *
static_cast<ParameterType*
>(_par); }
161 const ParameterType& parameter()
const {
return *
static_cast<const ParameterType*
>(_par); }
169 static services::SharedPtr<Batch<algorithmFPType, method> > create(
size_t nClasses,
size_t numberOfTerms);
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 = _result->allocate<algorithmFPType>(&input, _par, (int) method);
180 _res = _result.get();
186 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
188 _par = sumOfFunctionsParameter;
213 template<
typename algorithmFPType, Method method, CpuType cpu>
214 class DAAL_EXPORT BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
222 BatchContainer(daal::services::Environment::env *daalEnv);
224 virtual ~BatchContainer();
230 virtual services::Status compute() DAAL_C11_OVERRIDE;
249 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
250 class DAAL_EXPORT Batch :
public sum_of_functions::Batch
253 typedef sum_of_functions::Batch super;
255 typedef algorithms::optimization_solver::cross_entropy_loss::Input InputType;
256 typedef algorithms::optimization_solver::cross_entropy_loss::Parameter ParameterType;
257 typedef typename super::ResultType ResultType;
262 Batch(
size_t nClasses,
size_t numberOfTerms);
272 Batch(
const Batch<algorithmFPType, method> &other);
278 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
285 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
287 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
295 services::Status allocate()
297 return allocateResult();
304 ParameterType& parameter() {
return *
static_cast<ParameterType*
>(_par); }
310 const ParameterType& parameter()
const {
return *
static_cast<const ParameterType*
>(_par); }
318 static services::SharedPtr<Batch<algorithmFPType, method> > create(
size_t nClasses,
size_t numberOfTerms);
321 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
323 return new Batch<algorithmFPType, method>(*this);
326 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
328 services::Status s = _result->allocate<algorithmFPType>(&input, _par, (int) method);
329 _res = _result.get();
335 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
344 using interface2::BatchContainer;
345 using interface2::Batch;
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::Batch
Batch(size_t nClasses, size_t numberOfTerms)
Definition: cross_entropy_loss_batch.h:106
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Parameter
Parameter for Cross-entropy loss objective function
Definition: cross_entropy_loss_types.h:85
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: cross_entropy_loss_batch.h:278
daal
Definition: algorithm_base_common.h:31
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::cross_entropy_loss::interface1::Batch
Computes the Cross-entropy loss objective function in the batch processing mode.
Definition: cross_entropy_loss_batch.h:94
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch
Computes the Cross-entropy loss objective function in the batch processing mode.
Definition: cross_entropy_loss_batch.h:250
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::allocate
services::Status allocate()
Definition: cross_entropy_loss_batch.h:295
daal::algorithms::optimization_solver::sum_of_functions::interface1::Batch
Interface for computing the Sum of functions in the batch processing mode.
Definition: sum_of_functions_batch.h:61
daal::batch
Definition: daal_defines.h:110
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::parameter
const ParameterType & parameter() const
Definition: cross_entropy_loss_batch.h:310
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::BatchContainer
Provides methods to run implementations of the Cross-entropy loss objective function. This class is associated with the Batch class and supports the method of computing the Cross-entropy loss objective function in the batch processing mode.
Definition: cross_entropy_loss_batch.h:214
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::input
InputType input
Definition: cross_entropy_loss_batch.h:192
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: cross_entropy_loss_batch.h:136
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::parameter
ParameterType & parameter()
Definition: cross_entropy_loss_batch.h:155
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: cross_entropy_loss_batch.h:161
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::parameter
ParameterType & parameter()
Definition: cross_entropy_loss_batch.h:304
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: cross_entropy_loss_batch.h:119
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::cross_entropy_loss::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: cross_entropy_loss_batch.h:129
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::BatchContainer
Provides methods to run implementations of the Cross-entropy loss objective function. This class is associated with the Batch class and supports the method of computing the Cross-entropy loss objective function in the batch processing mode.
Definition: cross_entropy_loss_batch.h:58
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: cross_entropy_loss_batch.h:285
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::allocate
services::Status allocate()
Definition: cross_entropy_loss_batch.h:146
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::input
InputType input
Definition: cross_entropy_loss_batch.h:340