Skip to main content

DBSOD: Density-Based Spatial Outlier Detection

Project description

DBSOD: Density-Based Spatial Outlier Detection

Official implementation of "DBSOD: Density-Based Spatial Outlier Detection". Paper preprint is coming soon.

Algorithm

While DBSCAN is a widely used clustering algorithm, it only provides a binary label for outliers and does not assign a continuous outlierness score. To address this limitation, we propose DBSOD, a density-based spatial outlier detection method inspired by DBSCAN. The algorithm estimates the consistency with which a data point is identified as an outlier across a range of neighborhood sizes:

DBSOD Algorithm

The algorithm systematically varies the neighborhood size parameter $\epsilon$, evaluating outlierness across multiple density assumptions. By aggregating binary outlier classifications across these scales, it produces a normalized outlierness score for each point, reflecting how consistently the point is identified as an outlier.

Installation

Note: the package was developed for Linux machines.

You can install package using pip:

pip install dbsod

Alternatively (for instance if you want to contribute) you may clone this repository, build dbsod and install it in .venv in editable mode:

git clone https://github.com/Kowd-PauUh/dbsod.git
cd dbsod
make install_g++
make install_eigen
make venv
make build

Usage

Take as an example this dataset:

import numpy as np

DATA = np.array([
    [0.35, 0.18],
    [0.60, 0.16],
    [0.40, 0.18],
    [0.40, 0.30],
    [0.30, 0.70],
])

We can use dbsod to calculate outlierness score for each point:

from dbsod import dbsod

EPS_SPACE = [0.15, 0.22]  # `eps` parameters used for calculating normalized outlierness score
MIN_PTS = 2               # minimum number of neighbors for the data point to become "core" point

# compute outlierness scores
outlierness_scores = dbsod(
    X=DATA,
    eps_space=EPS_SPACE,
    min_pts=MIN_PTS,
    metric='euclidean'
)

print(outlierness_scores)

The output will be: array([0. , 0.5, 0. , 0. , 1. ]).

Below is the visualization of this example:

Simple Example

On the real-world data (check out this example) result of DBSOD would look like:

Real-World Example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbsod-0.0.4.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbsod-0.0.4-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file dbsod-0.0.4.tar.gz.

File metadata

  • Download URL: dbsod-0.0.4.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dbsod-0.0.4.tar.gz
Algorithm Hash digest
SHA256 1a4e331f36fd5183ffda5e8c261dff35684e313984f6855eea1b24fec6a81722
MD5 c8da3614fa26516f4ad5ffad8fe4af80
BLAKE2b-256 e870c3672687e0302904aa0bcbfd9ba918228310c11771bf0585f5eb2c7e34e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbsod-0.0.4.tar.gz:

Publisher: python-publish.yml on Kowd-PauUh/dbsod

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbsod-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: dbsod-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dbsod-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2ecb74db12e6591f81b8dbfd50de92521ed654c4b5be4ff1020278c6d121c77a
MD5 d71460b4b130231fd0e9d6b7ca74c024
BLAKE2b-256 bb5fd8dba6c794344470ab100c4c4354991544ad39d78a11fa1704b79d841d2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbsod-0.0.4-py3-none-any.whl:

Publisher: python-publish.yml on Kowd-PauUh/dbsod

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page