25 #ifndef __CROSS_ENTROPY_BATCH_H__
26 #define __CROSS_ENTROPY_BATCH_H__
28 #include "algorithms/algorithm.h"
29 #include "data_management/data/numeric_table.h"
30 #include "services/daal_defines.h"
31 #include "sum_of_functions_batch.h"
32 #include "cross_entropy_loss_types.h"
38 namespace optimization_solver
40 namespace cross_entropy_loss
59 template<
typename algorithmFPType, Method method, CpuType cpu>
60 class BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
68 DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv);
70 DAAL_DEPRECATED_VIRTUAL
virtual ~BatchContainer();
76 DAAL_DEPRECATED_VIRTUAL
virtual services::Status compute() DAAL_C11_OVERRIDE;
95 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
96 class DAAL_EXPORT Batch :
public sum_of_functions::interface1::Batch
99 typedef sum_of_functions::interface1::Batch super;
101 typedef algorithms::optimization_solver::cross_entropy_loss::interface1::Input InputType;
102 typedef algorithms::optimization_solver::cross_entropy_loss::interface1::Parameter ParameterType;
103 typedef typename super::ResultType ResultType;
108 DAAL_DEPRECATED Batch(
size_t nClasses,
size_t numberOfTerms) : sum_of_functions::interface1::Batch(numberOfTerms, &input, new ParameterType(nClasses, numberOfTerms))
113 DAAL_DEPRECATED_VIRTUAL
virtual ~Batch() {}
121 DAAL_DEPRECATED Batch(
const Batch<algorithmFPType, method> &other) :
122 sum_of_functions::interface1::Batch(other.parameter().numberOfTerms, &input, new ParameterType(other.parameter())), input(other.input)
131 DAAL_DEPRECATED_VIRTUAL
virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
138 DAAL_DEPRECATED services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
140 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
148 DAAL_DEPRECATED services::Status allocate()
150 return allocateResult();
157 DAAL_DEPRECATED ParameterType& parameter() {
return *
static_cast<ParameterType*
>(_par); }
163 DAAL_DEPRECATED
const ParameterType& parameter()
const {
return *
static_cast<const ParameterType*
>(_par); }
171 DAAL_DEPRECATED
static services::SharedPtr<Batch<algorithmFPType, method> > create(
size_t nClasses,
size_t numberOfTerms);
174 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
176 return new Batch<algorithmFPType, method>(*this);
179 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
181 services::Status s = _result->allocate<algorithmFPType>(&input, _par, (int) method);
182 _res = _result.get();
188 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
190 _par = sumOfFunctionsParameter;
215 template<
typename algorithmFPType, Method method, CpuType cpu>
216 class BatchContainer :
public daal::algorithms::AnalysisContainerIface<batch>
224 BatchContainer(daal::services::Environment::env *daalEnv);
226 virtual ~BatchContainer();
232 virtual services::Status compute() DAAL_C11_OVERRIDE;
251 template<
typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
252 class DAAL_EXPORT Batch :
public sum_of_functions::Batch
255 typedef sum_of_functions::Batch super;
257 typedef algorithms::optimization_solver::cross_entropy_loss::Input InputType;
258 typedef algorithms::optimization_solver::cross_entropy_loss::Parameter ParameterType;
259 typedef typename super::ResultType ResultType;
264 Batch(
size_t nClasses,
size_t numberOfTerms);
274 Batch(
const Batch<algorithmFPType, method> &other);
280 virtual int getMethod() const DAAL_C11_OVERRIDE {
return(
int)method; }
287 services::SharedPtr<Batch<algorithmFPType, method> > clone()
const
289 return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
297 services::Status allocate()
299 return allocateResult();
306 ParameterType& parameter() {
return *
static_cast<ParameterType*
>(_par); }
312 const ParameterType& parameter()
const {
return *
static_cast<const ParameterType*
>(_par); }
320 static services::SharedPtr<Batch<algorithmFPType, method> > create(
size_t nClasses,
size_t numberOfTerms);
323 virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
325 return new Batch<algorithmFPType, method>(*this);
328 virtual services::Status allocateResult() DAAL_C11_OVERRIDE
330 services::Status s = _result->allocate<algorithmFPType>(&input, _par, (int) method);
331 _res = _result.get();
337 Analysis<batch>::_ac =
new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
346 using interface2::BatchContainer;
347 using interface2::Batch;
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:60
daal::batch
Definition: daal_defines.h:112
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: cross_entropy_loss_batch.h:287
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::BatchContainer::compute
virtual DAAL_DEPRECATED_VIRTUAL services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::BatchContainer::~BatchContainer
virtual ~BatchContainer()
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::getMethod
virtual DAAL_DEPRECATED_VIRTUAL int getMethod() const DAAL_C11_OVERRIDE
Definition: cross_entropy_loss_batch.h:131
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::parameter
ParameterType & parameter()
Definition: cross_entropy_loss_batch.h:306
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:63
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::BatchContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: cross_entropy_loss_batch.h:280
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:216
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::Batch
DAAL_DEPRECATED Batch(size_t nClasses, size_t numberOfTerms)
Definition: cross_entropy_loss_batch.h:108
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::parameter
DAAL_DEPRECATED const ParameterType & parameter() const
Definition: cross_entropy_loss_batch.h:163
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Parameter
Parameter for Cross-entropy loss objective function
Definition: cross_entropy_loss_types.h:87
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::input
InputType input
Definition: cross_entropy_loss_batch.h:194
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::allocate
services::Status allocate()
Definition: cross_entropy_loss_batch.h:297
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:96
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::BatchContainer::BatchContainer
DAAL_DEPRECATED BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Input
Input objects for the Cross-entropy loss objective function
Definition: cross_entropy_loss_types.h:128
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::parameter
DAAL_DEPRECATED ParameterType & parameter()
Definition: cross_entropy_loss_batch.h:157
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::clone
DAAL_DEPRECATED services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: cross_entropy_loss_batch.h:138
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::input
InputType input
Definition: cross_entropy_loss_batch.h:342
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::BatchContainer::~BatchContainer
virtual DAAL_DEPRECATED_VIRTUAL ~BatchContainer()
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::allocate
DAAL_DEPRECATED services::Status allocate()
Definition: cross_entropy_loss_batch.h:148
daal::algorithms::optimization_solver::cross_entropy_loss::interface1::Batch::Batch
DAAL_DEPRECATED Batch(const Batch< algorithmFPType, method > &other)
Definition: cross_entropy_loss_batch.h:121
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::optimization_solver::cross_entropy_loss::interface2::Batch::parameter
const ParameterType & parameter() const
Definition: cross_entropy_loss_batch.h:312
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:252