Skip to main content

CMAD: Convolution Matrix Anomaly Detection for negative spatio-temporal anomalies

Project description

CMAD — Convolution Matrix Anomaly Detection

CMAD is a lightweight, unsupervised framework for detecting negative spatio-temporal anomalies in sequential 2D data.
It is designed for applications such as ice melt detection, environmental degradation, loss analysis, and decline-focused change detection.

CMAD operates on consecutive time steps, requires no labels, and adapts automatically to arbitrary spatial resolutions.


⚠️ Important Version Note

This version of CMAD detects negative anomalies only.

An anomaly is flagged only when the change between consecutive time steps is negative (e.g., loss, decrease, melting, erosion).

Positive changes are intentionally ignored in this release.


Key Features

  • ✔ Unsupervised (no training labels required)
  • ✔ Works with images or generic 2D time-series arrays
  • ✔ Supports arbitrary spatial dimensions (no fixed size)
  • ✔ Adaptive IQR-based thresholding
  • ✔ Binary anomaly masks (1 = anomaly, 0 = normal)
  • ✔ CPU-only by default (GPU-ready via PyTorch)
  • ✔ Suitable for large spatio-temporal datasets

Method Overview

Given a time series of 2D data
[ X = {X_1, X_2, \dots, X_T}, \quad X_t \in \mathbb{R}^{H \times W} ]

CMAD performs:

  1. Temporal differencing [ D_t = X_{t+1} - X_t ]

  2. 2×2 convolution + stride-2 downsampling

  3. Second-stage 2×2 pooling

    • Produces local neighborhoods of 4 values
  4. Adaptive IQR thresholding

    • Per-cell thresholds learned from training data
  5. Back-projection

    • Anomalies mapped to original resolution using 4-corner mapping
  6. Negative-only filtering

    • A location is anomalous only if:
      • It exceeds the adaptive threshold and
      • The temporal difference is negative

Installation

pip install cmad

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

cmad-0.1.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

cmad-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file cmad-0.1.0.tar.gz.

File metadata

  • Download URL: cmad-0.1.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.17

File hashes

Hashes for cmad-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f79f561aa7083044b0ca03c9a4730772f5c7a72c62db176fcc93606408c0d030
MD5 abda1b7ec073559759cf5688af618437
BLAKE2b-256 091da214d29d929eeafb9b53747573f08644b4fb03bd649e3cd203f1649da5b0

See more details on using hashes here.

File details

Details for the file cmad-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cmad-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.17

File hashes

Hashes for cmad-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb0976886b51f0c6b4b572885f747bd82e502a5bcbfd5e764ed422ee39f2f4c7
MD5 01a5b212211c3e9ed72a9397982b49c4
BLAKE2b-256 cb68ca6061bc4b472938f543daf7f459999a868eeea8786b114f10c9f0682a39

See more details on using hashes here.

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