C++ API Reference for Intel® Data Analytics Acceleration Library 2019 Update 4

logistic_loss_batch.h
1 /* file: logistic_loss_batch.h */
2 /*******************************************************************************
3 * Copyright 2014-2019 Intel Corporation.
4 *
5 * This software and the related documents are Intel copyrighted materials, and
6 * your use of them is governed by the express license under which they were
7 * provided to you (License). Unless the License provides otherwise, you may not
8 * use, modify, copy, publish, distribute, disclose or transmit this software or
9 * the related documents without Intel's prior written permission.
10 *
11 * This software and the related documents are provided as is, with no express
12 * or implied warranties, other than those that are expressly stated in the
13 * License.
14 *******************************************************************************/
15 
16 /*
17 //++
18 // Implementation of the Logistic loss objective function in the batch
19 // processing mode
20 //--
21 */
22 
23 #ifndef __LOGISTIC_LOSS_BATCH_H__
24 #define __LOGISTIC_LOSS_BATCH_H__
25 
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 "logistic_loss_types.h"
31 
32 namespace daal
33 {
34 namespace algorithms
35 {
36 namespace optimization_solver
37 {
38 namespace logistic_loss
39 {
40 
41 namespace interface1
42 {
57 template<typename algorithmFPType, Method method, CpuType cpu>
58 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
59 {
60 public:
66  BatchContainer(daal::services::Environment::env *daalEnv);
68  virtual ~BatchContainer();
74  virtual services::Status compute() DAAL_C11_OVERRIDE;
75 };
76 
93 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
94 class DAAL_EXPORT Batch : public sum_of_functions::Batch
95 {
96 public:
97  typedef sum_of_functions::Batch super;
98  typedef algorithms::optimization_solver::logistic_loss::Input InputType;
99  typedef algorithms::optimization_solver::logistic_loss::Parameter ParameterType;
100  typedef typename super::ResultType ResultType;
101 
105  Batch(size_t numberOfTerms) : sum_of_functions::Batch(numberOfTerms, &input, new ParameterType(numberOfTerms))
106  {
107  initialize();
108  }
109 
110  virtual ~Batch() {}
111 
118  Batch(const Batch<algorithmFPType, method> &other) :
119  sum_of_functions::Batch(other.parameter().numberOfTerms, &input, new ParameterType(other.parameter())), input(other.input)
120  {
121  initialize();
122  }
123 
128  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int)method; }
129 
135  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
136  {
137  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
138  }
139 
145  services::Status allocate()
146  {
147  return allocateResult();
148  }
149 
154  ParameterType& parameter() { return *static_cast<ParameterType*>(_par); }
155 
160  const ParameterType& parameter() const { return *static_cast<const ParameterType*>(_par); }
161 
167  static services::SharedPtr<Batch<algorithmFPType, method> > create(size_t numberOfTerms);
168 
169 protected:
170  virtual Batch<algorithmFPType, method> *cloneImpl() const DAAL_C11_OVERRIDE
171  {
172  return new Batch<algorithmFPType, method>(*this);
173  }
174 
175  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
176  {
177  services::Status s = _result->allocate<algorithmFPType>(&input, _par, (int) method);
178  _res = _result.get();
179  return s;
180  }
181 
182  void initialize()
183  {
184  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
185  _in = &input;
186  _par = sumOfFunctionsParameter;
187  }
188 
189 public:
190  InputType input;
191 };
193 } // namespace interface1
194 using interface1::BatchContainer;
195 using interface1::Batch;
196 
197 } // namespace logistic_loss
198 } // namespace optimization_solver
199 } // namespace algorithm
200 } // namespace daal
201 #endif
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch::parameter
const ParameterType & parameter() const
Definition: logistic_loss_batch.h:160
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::logistic_loss::interface1::Batch::Batch
Batch(size_t numberOfTerms)
Definition: logistic_loss_batch.h:105
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch
Computes the Logistic loss objective function in the batch processing mode.
Definition: logistic_loss_batch.h:94
daal::algorithms::optimization_solver::logistic_loss::interface1::BatchContainer
Provides methods to run implementations of the Logistic loss objective function. This class is associ...
Definition: logistic_loss_batch.h:58
daal_defines.h
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: logistic_loss_batch.h:118
daal::batch
Definition: daal_defines.h:110
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: logistic_loss_batch.h:135
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch::allocate
services::Status allocate()
Definition: logistic_loss_batch.h:145
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::logistic_loss::interface1::Batch::input
InputType input
Definition: logistic_loss_batch.h:190
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch::parameter
ParameterType & parameter()
Definition: logistic_loss_batch.h:154
daal::algorithms::optimization_solver::logistic_loss::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: logistic_loss_batch.h:128

For more complete information about compiler optimizations, see our Optimization Notice.