C++ API Reference for Intel® Data Analytics Acceleration Library 2018 Update 2

outlier_detection_bacon.h
1 /* file: outlier_detection_bacon.h */
2 /*******************************************************************************
3 * Copyright 2014-2018 Intel Corporation
4 * All Rights Reserved.
5 *
6 * If this software was obtained under the Intel Simplified Software License,
7 * the following terms apply:
8 *
9 * The source code, information and material ("Material") contained herein is
10 * owned by Intel Corporation or its suppliers or licensors, and title to such
11 * Material remains with Intel Corporation or its suppliers or licensors. The
12 * Material contains proprietary information of Intel or its suppliers and
13 * licensors. The Material is protected by worldwide copyright laws and treaty
14 * provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed or disclosed
16 * in any way without Intel's prior express written permission. No license under
17 * any patent, copyright or other intellectual property rights in the Material
18 * is granted to or conferred upon you, either expressly, by implication,
19 * inducement, estoppel or otherwise. Any license under such intellectual
20 * property rights must be express and approved by Intel in writing.
21 *
22 * Unless otherwise agreed by Intel in writing, you may not remove or alter this
23 * notice or any other notice embedded in Materials by Intel or Intel's
24 * suppliers or licensors in any way.
25 *
26 *
27 * If this software was obtained under the Apache License, Version 2.0 (the
28 * "License"), the following terms apply:
29 *
30 * You may not use this file except in compliance with the License. You may
31 * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
32 *
33 *
34 * Unless required by applicable law or agreed to in writing, software
35 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
36 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
37 *
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
40 *******************************************************************************/
41 
42 /*
43 //++
44 // Implementation of the interface for the BACON outlier detection algorithm
45 // in the batch processing mode
46 //--
47 */
48 
49 #ifndef __OUTLIER_DETECTION_BACON_H__
50 #define __OUTLIER_DETECTION_BACON_H__
51 
52 #include "algorithms/algorithm.h"
53 #include "data_management/data/numeric_table.h"
54 #include "services/daal_defines.h"
55 #include "algorithms/outlier_detection/outlier_detection_bacon_types.h"
56 
57 namespace daal
58 {
59 namespace algorithms
60 {
61 namespace bacon_outlier_detection
62 {
63 
64 namespace interface1
65 {
80 template<typename algorithmFPType, Method method, CpuType cpu>
81 class DAAL_EXPORT BatchContainer : public daal::algorithms::AnalysisContainerIface<batch>
82 {
83 public:
89  BatchContainer(daal::services::Environment::env *daalEnv);
91  ~BatchContainer();
97  virtual services::Status compute() DAAL_C11_OVERRIDE;
98 };
99 
118 template<typename algorithmFPType = DAAL_ALGORITHM_FP_TYPE, Method method = defaultDense>
119 class DAAL_EXPORT Batch : public daal::algorithms::Analysis<batch>
120 {
121 public:
122  typedef algorithms::bacon_outlier_detection::Input InputType;
123  typedef algorithms::bacon_outlier_detection::Parameter ParameterType;
124  typedef algorithms::bacon_outlier_detection::Result ResultType;
125 
127  Batch()
128  {
129  initialize();
130  }
131 
138  Batch(const Batch<algorithmFPType, method> &other) : input(other.input), parameter(other.parameter)
139  {
140  initialize();
141  }
142 
147  virtual int getMethod() const DAAL_C11_OVERRIDE { return(int) method; }
148 
153  ResultPtr getResult()
154  {
155  return _result;
156  }
157 
164  services::Status setResult(const ResultPtr& result)
165  {
166  DAAL_CHECK(result, services::ErrorNullResult)
167  _result = result;
168  _res = _result.get();
169  return services::Status();
170  }
171 
177  services::SharedPtr<Batch<algorithmFPType, method> > clone() const
178  {
179  return services::SharedPtr<Batch<algorithmFPType, method> >(cloneImpl());
180  }
181 
182 protected:
183  virtual Batch<algorithmFPType, method> * cloneImpl() const DAAL_C11_OVERRIDE
184  {
185  return new Batch<algorithmFPType, method>(*this);
186  }
187 
188  virtual services::Status allocateResult() DAAL_C11_OVERRIDE
189  {
190  services::Status s = _result->allocate<algorithmFPType>(&input, NULL, (int) method);
191  _res = _result.get();
192  return s;
193  }
194 
195  void initialize()
196  {
197  Analysis<batch>::_ac = new __DAAL_ALGORITHM_CONTAINER(batch, BatchContainer, algorithmFPType, method)(&_env);
198  _in = &input;
199  _par = &parameter;
200  _result.reset(new ResultType());
201  }
202 
203 public:
204  InputType input;
205  ParameterType parameter;
207 private:
208  ResultPtr _result;
209 };
211 } // namespace interface1
212 using interface1::BatchContainer;
213 using interface1::Batch;
214 
215 } // namespace bacon_outlier_detection
216 } // namespace algorithm
217 } // namespace daal
218 #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:119
daal::algorithms::bacon_outlier_detection::interface1::Input
Input objects for the BACON outlier detection algorithm
Definition: outlier_detection_bacon_types.h:138
daal::services::interface1::Environment::_envStruct
The environment structure.
Definition: env_detect.h:95
daal::services::interface1::Status
Class that holds the results of API calls. In case of API routine failure it contains the list of err...
Definition: error_handling.h:491
daal
Definition: algorithm_base_common.h:57
daal::algorithms::AnalysisContainerIface
Abstract interface class that provides virtual methods to access and run implementations of the analy...
Definition: analysis.h:79
daal_defines.h
daal::algorithms::bacon_outlier_detection::interface1::Batch::getMethod
virtual int getMethod() const DAAL_C11_OVERRIDE
Definition: outlier_detection_bacon.h:147
daal::batch
Definition: daal_defines.h:132
daal::services::interface1::SharedPtr
Shared pointer that retains shared ownership of an object through a pointer. Several SharedPtr object...
Definition: daal_shared_ptr.h:187
daal::services::interface1::SharedPtr::get
T * get() const
Definition: daal_shared_ptr.h:332
daal::algorithms::bacon_outlier_detection::interface1::Batch::input
InputType input
Definition: outlier_detection_bacon.h:204
daal::algorithms::bacon_outlier_detection::interface1::Parameter
Parameters of the outlier detection computation using the baconDense method.
Definition: outlier_detection_bacon_types.h:119
daal::algorithms::bacon_outlier_detection::interface1::Batch::setResult
services::Status setResult(const ResultPtr &result)
Definition: outlier_detection_bacon.h:164
daal::algorithms::Analysis
Provides methods for execution of operations over data, such as computation of Summary Statistics est...
Definition: analysis.h:94
daal::algorithms::bacon_outlier_detection::interface1::Batch::clone
services::SharedPtr< Batch< algorithmFPType, method > > clone() const
Definition: outlier_detection_bacon.h:177
daal::algorithms::bacon_outlier_detection::interface1::Result
Results obtained with the compute() method of the BACON outlier detection algorithm in the batch proc...
Definition: outlier_detection_bacon_types.h:174
daal::algorithms::bacon_outlier_detection::interface1::Batch::parameter
ParameterType parameter
Definition: outlier_detection_bacon.h:205
daal::algorithms::bacon_outlier_detection::interface1::Batch::Batch
Batch(const Batch< algorithmFPType, method > &other)
Definition: outlier_detection_bacon.h:138
daal::algorithms::bacon_outlier_detection::interface1::Batch::getResult
ResultPtr getResult()
Definition: outlier_detection_bacon.h:153
daal::algorithms::bacon_outlier_detection::interface1::Batch::Batch
Batch()
Definition: outlier_detection_bacon.h:127
daal::services::ErrorNullResult
Definition: error_indexes.h:122
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:81

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