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

apriori.h
1 /* file: apriori.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 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 interface for the association rules algorithm
19 //--
20 */
21 
22 #ifndef __APRIORI_H__
23 #define __APRIORI_H__
24 
25 #include "algorithms/algorithm.h"
26 #include "data_management/data/numeric_table.h"
27 #include "services/daal_defines.h"
28 #include "algorithms/association_rules/apriori_types.h"
29 
30 namespace daal
31 {
32 namespace algorithms
33 {
34 namespace association_rules
35 {
36 namespace interface1
37 {
51 template<typename algorithmFPType, Method method, CpuType cpu>
52 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
53 {
54 public:
60  BatchContainer(daal::services::Environment::env *daalEnv);
62  ~BatchContainer();
66  virtual services::Status compute();
67 };
68 
82 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = apriori>
83 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
84 {
85 public:
86  typedef algorithms::association_rules::Input InputType;
87  typedef algorithms::association_rules::Parameter ParameterType;
88  typedef algorithms::association_rules::Result ResultType;
89 
91  Batch()
92  {
93  initialize();
94  }
95 
102  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
103  {
104  initialize();
105  }
106 
111  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
112 
117  ResultPtr getResult()
118  {
119  return _result;
120  }
121 
126  services::Status setResult(const ResultPtr& res)
127  {
128  DAAL_CHECK(res, services::ErrorNullResult)
129  _result = res;
130  _res = _result.get();
131  return services::Status();
132  }
133 
139  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
140  {
141  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
142  }
143 
144 protected:
145  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
146  {
147  return new Batch<algorithmFPType, method>(*this);
148  }
149 
150  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
151  {
152  services::Status s = _result->allocate<algorithmFPType>(&input, &parameter, (int) method);
153  _res = _result.get();
154  return s;
155  }
156 
157  void initialize()
158  {
159  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
160  _in = &input;
161  _par = &parameter;
162  _result.reset(new ResultType());
163  }
164 public:
165  InputType input;
166  ParameterType parameter;
168 private:
169  ResultPtr _result;
170 };
172 } // namespace interface1
173 using interface1::BatchContainer;
174 using interface1::Batch;
175 
176 } // namespace association_rules
177 } // namespace algorithm
178 } // namespace daal
179 #endif
daal::algorithms::association_rules::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: apriori.h:102
daal
Definition: algorithm_base_common.h:31
daal::algorithms::association_rules::interface1::Batch::parameter
ParameterType parameter
Definition: apriori.h:166
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:53
daal::algorithms::association_rules::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: apriori.h:139
daal::algorithms::association_rules::interface1::BatchContainer
Provides methods to run implementations of the association rules algorithm. This class is associated ...
Definition: apriori.h:52
daal::algorithms::association_rules::interface1::Batch::getResult
ResultPtr getResult()
Definition: apriori.h:117
daal_defines.h
daal::batch
Definition: daal_defines.h:106
daal::algorithms::association_rules::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: apriori.h:111
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:68
daal::algorithms::association_rules::interface1::Batch::input
InputType input
Definition: apriori.h:165
daal::algorithms::association_rules::interface1::Batch::setResult
services::Status setResult(const ResultPtr &res)
Definition: apriori.h:126
daal::services::ErrorNullResult
Definition: error_indexes.h:96
daal::algorithms::association_rules::interface1::Batch
Computes the result of the association rules algorithm in the batch processing mode.
Definition: apriori.h:83
daal::algorithms::association_rules::interface1::Batch::Batch
Batch()
Definition: apriori.h:91

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