C++ API Reference for Intel® Data Analytics Acceleration Library 2020 Update 1

outlier_detection_bacon.h
1 /* file: outlier_detection_bacon.h */
2 /*******************************************************************************
3 * Copyright 2014-2020 Intel Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *******************************************************************************/
17 
18 /*
19 //++
20 // Implementation of the interface for the BACON outlier detection algorithm
21 // in the batch processing mode
22 //--
23 */
24 
25 #ifndef __OUTLIER_DETECTION_BACON_H__
26 #define __OUTLIER_DETECTION_BACON_H__
27 
28 #include "algorithms/algorithm.h"
29 #include "data_management/data/numeric_table.h"
30 #include "services/daal_defines.h"
31 #include "algorithms/outlier_detection/outlier_detection_bacon_types.h"
32 
33 namespace daal
34 {
35 namespace algorithms
36 {
37 namespace bacon_outlier_detection
38 {
39 
40 namespace interface1
41 {
56 template<typename algorithmFPType, Method method, CpuType cpu>
57 class BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
58 {
59 public:
65  BatchContainer(daal::services::Environment::env *daalEnv);
67  ~BatchContainer();
73  virtual services::Status compute() DAAL_C11_OVERRIDE;
74 };
75 
94 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
95 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
96 {
97 public:
98  typedef algorithms::bacon_outlier_detection::Input InputType;
99  typedef algorithms::bacon_outlier_detection::Parameter ParameterType;
100  typedef algorithms::bacon_outlier_detection::Result ResultType;
101 
103  Batch()
104  {
105  initialize();
106  }
107 
114  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
115  {
116  initialize();
117  }
118 
123  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
124 
129  ResultPtr getResult()
130  {
131  return _result;
132  }
133 
140  services::Status setResult(const ResultPtr& result)
141  {
142  DAAL_CHECK(result, services::ErrorNullResult)
143  _result = result;
144  _res = _result.get();
145  return services::Status();
146  }
147 
153  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
154  {
155  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
156  }
157 
158 protected:
159  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
160  {
161  return new Batch<algorithmFPType, method>(*this);
162  }
163 
164  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
165  {
166  services::Status s = _result->allocate<algorithmFPType>(&input, NULL, (int) method);
167  _res = _result.get();
168  return s;
169  }
170 
171  void initialize()
172  {
173  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
174  _in = &input;
175  _par = &parameter;
176  _result.reset(new ResultType());
177  }
178 
179 public:
180  InputType input;
181  ParameterType parameter;
183 private:
184  ResultPtr _result;
185 };
187 } // namespace interface1
188 using interface1::BatchContainer;
189 using interface1::Batch;
190 
191 } // namespace bacon_outlier_detection
192 } // namespace algorithm
193 } // namespace daal
194 #endif
daal::algorithms::bacon_outlier_detection::interface1::Batch
Abstract class that specifies interface of the algorithms for computing BACON outlier detection in th...
Definition: outlier_detection_bacon.h:95
daal::algorithms::bacon_outlier_detection::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: outlier_detection_bacon.h:114
daal::batch
Definition: daal_defines.h:112
daal::algorithms::bacon_outlier_detection::interface1::BatchContainer::BatchContainer
BatchContainer(daal::services::Environment::env *daalEnv)
daal::algorithms::bacon_outlier_detection::interface1::Batch::input
InputType input
Definition: outlier_detection_bacon.h:180
daal::algorithms::bacon_outlier_detection::interface1::BatchContainer::compute
virtual services::Status compute() DAAL_C11_OVERRIDE
daal::services::ErrorNullResult
Definition: error_indexes.h:98
daal::algorithms::bacon_outlier_detection::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: outlier_detection_bacon.h:153
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:55
daal::algorithms::bacon_outlier_detection::interface1::Batch::getResult
ResultPtr getResult()
Definition: outlier_detection_bacon.h:129
daal::algorithms::bacon_outlier_detection::interface1::BatchContainer
Provides methods to run implementations of the BACON outlier detection algorithm. This class is assoc...
Definition: outlier_detection_bacon.h:57
daal::algorithms::bacon_outlier_detection::interface1::Batch::parameter
ParameterType parameter
Definition: outlier_detection_bacon.h:181
daal_defines.h
daal::algorithms::bacon_outlier_detection::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: outlier_detection_bacon.h:123
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:70
daal::algorithms::bacon_outlier_detection::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: outlier_detection_bacon.h:140
daal::algorithms::bacon_outlier_detection::interface1::BatchContainer::~BatchContainer
~BatchContainer()
daal::algorithms::bacon_outlier_detection::interface1::Batch::Batch
Batch()
Definition: outlier_detection_bacon.h:103

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