Skip to content

Commit 8a44e35

Browse files
committed
Documentation update
1 parent 8369129 commit 8a44e35

File tree

7 files changed

+88
-114
lines changed

7 files changed

+88
-114
lines changed

sphinx/source/introduction/ad.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ Advanced anomaly analysis
4141
~~~~~~~~~~~~~~~~~~~~~~~~~
4242
1. Histogram Based Outlier Score (HBOS) is a deterministic and non-parametric statistical anomaly detection algorithm. It is implemented as part of Chimbuko's anomaly analysis module. HBOS is an unsupervised anomaly detection algorithm which scores data in linear time. It supports dynamic bin widths which ensures long-tail distributions of function executions are captured and global anomalies are detected better. HBOS normalizes the histogram and calculates the anomaly scores by taking inverse of estimated densities of function executions. The score is a multiplication of the inverse of the estimated densities given by the following Equation
4343

44-
.. math::
45-
HBOS_{i} = \log_{2} (1 / density_{i})
44+
.. math::
45+
HBOS_{i} = \log_{2} (1 / density_{i} + \alpha)
4646
47-
where :math:`i` is a function execution and :math:`density_{i}` is function execution probability. HBOS works in :math:`O(nlogn)` using dynamic bin-width or in linear time :math:`O(n)` using fixed bin width. After scoring, the top 1% of scores are filtered as anomalous function executions. This filter value can be set at runtime to adjust the density of detected anomalies.
47+
where :math:`i` is the index of a particular a function execution and :math:`density_{i}` is function execution probability. The offset :math:`\alpha` is chosen such that the scores lie in the range :math:`0\to 100`. HBOS works in :math:`O(nlogn)` using dynamic bin-width or in linear time :math:`O(n)` using fixed bin width. After scoring, the top 1% of scores are filtered as anomalous function executions. This filter value can be set at runtime to adjust the density of detected anomalies.
4848

4949
2. Another algorithm is added into Chimbuko's advanced anomaly analysis called the COPula based Outlier Detection (COPOD), which is a deterministic, parameter-free anomaly detection algorithm. It computes empirical copulas for each sample in the dataset. A copula defines the dependence structure between random variables. For each sample in the dataset, COPOD algorithm computes left-tail empirical copula from left-tail empirical cumulative distribution function, right-tail copula from right-tail empirical cumulative distribution function, and a skewness-corrected empirical copula using a skewness coefficient calculated from left-tail and right-tail empirical cumulative distribution functions. These three computed values are interpreted as left-tail, right-tail, and skewness-corrected probabilities, respectively. Lowest probability value results in largest negative-log value, which is the score assigned to the sample in the dataset. Samples with the highest scores in the dataset are tagged as anomalous.
5050

sphinx/source/introduction/provdb.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
Provenance Database
33
*******************
44

5-
The role of the provenance database is three-fold:
5+
The role of the provenance database is four-fold:
66

77
- To store detailed information about anomalous function executions and also, for comparison, samples of normal executions. Stored in the **anomaly database**.
88
- To store a wealth of metadata regarding the characteristics of the devices upon which the application is running. Stored in the **anomaly database**.
99
- To store globally-aggregated function profile data and counter averages that reflect the overall running of the application. Stored in the **global database**.
10-
10+
- To store the final AD model for each function. Stored in the **global database**.
11+
1112
The databases are implemented using `Sonata <https://xgitlab.cels.anl.gov/sds/sonata>`_ which implements a remote database built on top of `UnQLite <https://unqlite.org/>`_, a server-less JSON document store database. Sonata is capable of furnishing many clients and allows for arbitrarily complex document retrieval via `jx9 queries <https://unqlite.org/jx9.html>`_.
1213

1314
In order to improve parallelizability the **anomaly database**, which stores the provenance data and metadata collected from the AD instances, is sharded (split over multiple independent instances), with the AD instances assigned to a shared in a round-robin fashion based on their rank index. The database shared are organized into three *collections*:
@@ -20,6 +21,7 @@ The **global database** exists as a single shard, and is written to at the very
2021

2122
* **func_stats** : function profile information including statistics (mean, std. dev., etc) on the inclusive and exclusive runtimes as well as the number and frequency of anomalues.
2223
* **counter_stats** : averages of various counters collected over the run.
24+
* **ad_model** : the final AD model for each function.
2325

2426
The schemata for the contents of both database components are described here: :ref:`io_schema/provdb_schema:Provenance Database Schema`
2527

sphinx/source/introduction/ps.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ Design
1919

2020
(**C**)lients (i.e. on-node AD modules) send requests with their locally-computed anomaly detection algorithm parameters to be aggregated with the global parameters and the updated parameters returned to the client. Network communication is performed using the `ZeroMQ <https://zeromq.org>`_ library and using `Cereal <https://uscilab.github.io/cereal/>`_ for data serialization.
2121

22-
For handling requests from a large number of connected clients the parameter server uses a ROUTER-DEALER pattern whereby requests are sent to a **Frontend** router and distributed over thread (**W**)orkers
23-
via the **Backend** router in round-robin fashion. For the task of updating parameters, workers first acquire a global lock, and update the **in-mem DB**, and return the updated parameters (cf. :ref:`api/api_code:SstdParam`). Global statistics on anomalies and counters are compiled in a similar way using the data sent from the AD instances (cf. `global_anomaly_stats <../api/api_code.html#global-anomaly-stats>`__ and `global_counter_stats <../api/api_code.html#global-counter-stats>`__) and also stored in this database.
22+
For handling requests from a large number of connected clients the parameter server uses a ROUTER-DEALER pattern whereby requests are sent to a **Frontend** router and distributed over thread (**W**)orkers via the **Backend** router in round-robin fashion.
23+
24+
For the task of updating parameters, scalability is ensured by having each worker write to a separate parameter object in the **In-Mem DB**. These are periodically aggregated by a background thread and the global model updated, typically once per second such that the AD instances receive the most up-to-date model as possible. Global statistics on anomalies and counters are compiled in a similar way using the data sent from the AD instances (cf. `global_anomaly_stats <../api/api_code.html#global-anomaly-stats>`__ and `global_counter_stats <../api/api_code.html#global-counter-stats>`__) and also stored in this database.
2425

2526
A dedicated (**S**)treaming thread (cf. :ref:`api/api_code:PSstatSender`) is maintained that periodically sends the latest global statistics to the visualization server.
2627

sphinx/source/io_schema/provdb_schema.rst

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Provenance Database Schema
55
Main database
66
-------------
77

8-
Below we describe the JSON schema for the **anomalies** and **normalexecs** collections of the **main database** component of the provenance database.
8+
Below we describe the JSON schema for the **anomalies**, **normalexecs** and **metadata** collections of the **main database** component of the provenance database.
99

1010
Function event schema
1111
^^^^^^^^^^^^^^^^^^^^^
@@ -114,8 +114,12 @@ For the SSTD (original) algorithm, the **algo_params** field has the following f
114114
For the HBOS and COPOD algorithms, the **algo_params** field has the following format:
115115

116116
| {
117-
| **"Histogram Bin Counts"** : *the height of the histogram bin*,
118-
| **"Histogram Bin Edges"** : *the edges of the bins starting with the lower edge of bin 0 followed by the upper edges of bins 0..N*
117+
| **"histogram"**: *the histogram*,
118+
| {
119+
| **"Histogram Bin Counts"** : *the height of the histogram bin (array)* ,
120+
| **"Histogram Bin Edges"** : *the edges of the bins starting with the lower edge of bin 0 followed by the upper edges of bins 0..N (array)*
121+
| },
122+
| **"internal_global_threshold"** : *a score threshold for anomaly detection used internally*
119123
| }
120124
121125

@@ -180,7 +184,7 @@ Note that the **tid** (thread index) for metadata is usually 0, apart from for m
180184
Global database
181185
---------------
182186

183-
Below we describe the JSON schema for the **func_stats** and **counter_stats** collections of the **global database** component of the provenance database.
187+
Below we describe the JSON schema for the **func_stats**, **counter_stats** and **ad_model** collections of the **global database** component of the provenance database.
184188

185189
Function profile statistics schema
186190
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -247,3 +251,17 @@ The **counter_stats** collection has the following schema:
247251
| }
248252
| }
249253
254+
AD model schema
255+
^^^^^^^^^^^^^^^^^^^^^^^^^
256+
257+
The **ad_model** collection contains the final AD model for each function. It has the following schema:
258+
259+
| {
260+
| **"__id"**: *A unique record index*,
261+
| **"pid"**: *The program index*,
262+
| **"fid"**: *The function index*,
263+
| **"func_name"**: *The function name*,
264+
| **"model"** : *The model for this function, form dependent on algorithm used (object)*
265+
| }
266+
267+
The **"model"** entry has the same form as the **"algo_params"** entry of the main database, and is documented above.

0 commit comments

Comments
 (0)