@@ -245,5 +245,70 @@ namespace chimbuko {
245245
246246 };
247247
248+ /* *
249+ * @brief COPOD anomaly detection algorithm
250+ *
251+ */
252+ class ADOutlierCOPOD : public ADOutlier {
253+ public:
254+
255+ /* *
256+ * @brief Construct a new ADOutlierHBOS object
257+ *
258+ */
259+ ADOutlierCOPOD (OutlierStatistic stat = ExclusiveRuntime, double threshold = 0.99 , bool use_global_threshold = true );
260+
261+ /* *
262+ * @brief Destroy the ADOutlierHBOS object
263+ *
264+ */
265+ ~ADOutlierCOPOD ();
266+
267+ /* *
268+ * @brief Set the alpha value
269+ *
270+ * @param regularizer alpha value
271+ */
272+ void set_alpha (double alpha) { m_alpha = alpha; }
273+
274+ /* *
275+ * @brief run HBOS anomaly detection algorithm
276+ *
277+ * @param step step (or frame) number
278+ * @return data structure containing captured anomalies
279+ */
280+ Anomalies run (int step=0 ) override ;
281+
282+ protected:
283+ /* *
284+ * @brief compute outliers (or anomalies) of the list of function calls
285+ *
286+ * @param[out] outliers Array of function calls that were tagged as outliers
287+ * @param func_id function id
288+ * @param data[in,out] a list of function calls to inspect
289+ * @return unsigned long the number of outliers (or anomalies)
290+ */
291+ unsigned long compute_outliers (Anomalies &outliers,
292+ const unsigned long func_id, std::vector<CallListIterator_t>& data) override ;
293+
294+ /* *
295+ * @brief Scott's rule for bin_width estimation during histogram formation
296+ */
297+ double _scott_binWidth (std::vector<double >& vals);
298+
299+ /* *
300+ * @brief Assigns samples to corresponding bins in Histogram. Similar to numpy digitize in Python
301+ */
302+ int np_digitize_get_bin_inds (const double & X, const std::vector<double >& bin_edges);
303+
304+ private:
305+ double m_alpha; /* *< Used to prevent log2 overflow */
306+ double m_threshold; /* *< Threshold used to filter anomalies in HBOS*/
307+ bool m_use_global_threshold; /* *< Flag to use global threshold*/
308+ // double m_threshold; /** sync with global threshold */
309+ OutlierStatistic m_statistic; /* * Which statistic to use for outlier detection */
310+
311+ };
312+
248313
249314} // end of AD namespace
0 commit comments