A method for detecting anomalies in univariate and multivariate data
Project description
Perception Anomaly Detection.
This project contains the prototypical implemenation of the algorithm described in the paper "Anomaly Detection using Principle of Human Perception" that can be found at: https://arxiv.org/abs/2103.12323
The perception algorithm detects global anomalies in univariate and multivariate data parameter-free! Just give it the standardised data as a numpy array and it will return the label (normal or anomalous) of each observation. The algorithm also gives each observation a score that can be useful for further analysis and investigation.
Notes on the algorithm:
Returns the anomaly label and associated score of each observation.
The greater the score, above zero, the more anomalous an observation is.
This function specialises to one-dimensional data when the data only has one feature.
The fundamental formula for scoring the unexpectedness of an observation is: (S choose n) * 1/(W^{n-1})
However, this formula is transformed for computational reasons as detailed in the accompanying paper and code to: -1/S * (log(S choose n) - (n - 1) * log(W))
In the multi-dimensional case:
We take in scaled data and calculate each observations' distance from the median using a distance measure, for example Mahalanobis or Euclidean. Then, given the one-dimensional data, we apply the one-dimensional anomaly detection algorithm as before.
The 'Notebooks' folder contains a getting started guide and tutorial examples that are recommended to be run and examined if new to this project: https://github.com/M-Nassir/perception
Installation:
pip install perception_nassir
Usage:
from perception_nassir import Perception
data = np.array([2.1, 2.6, 2.4, 2.5, 2.3, 2.1, 2.3, 2.6, 8.2, 8.3])
clf = Perception()
clf.fit(data)
clf.predict(data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file perception_nassir-0.0.6.tar.gz.
File metadata
- Download URL: perception_nassir-0.0.6.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eae31fdca812fc31e1b0c6dcbc2f0206dfedfe59ce1fdb0bdda09c08a647633
|
|
| MD5 |
70c055ef1ecf99965118129ce652f1d6
|
|
| BLAKE2b-256 |
ebd617fafc378fec7e2671b5640cad9fd25cf0fd963f65beb87d002e8bc476b9
|
File details
Details for the file perception_nassir-0.0.6-py3-none-any.whl.
File metadata
- Download URL: perception_nassir-0.0.6-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43f94aae74b45720d2d1a5b14b280aaa5e36f9fcfd12a9f9941a281ce5786789
|
|
| MD5 |
9ebc5ec52ce2f6bfbaaadd22c2c7d046
|
|
| BLAKE2b-256 |
7a469f5ceb840a7d74163ee5653d0a0baf81bc8ac21c4d827f6b08c91ccd7cd6
|