Skip to main content

Stateless anomaly scoring library for forecast-based anomaly detection

Project description

spotanomaly2-safe

Features

Version & License

Python Version GitHub Release PyPI Version

License

Downloads

PyPI Downloads Total Downloads

Quality

EU AI Act Dependencies Audit Reliability Security

Testing

Build Status REUSE status

Scores

OpenSSF Best Practices OpenSSF Scorecard

Status

Maintenance Code style: ruff

Safety-Critical Design Goals

spotanomaly2-safe is a stateless anomaly scoring library for forecast-based anomaly detection in safety-critical production environments.

Unlike general-purpose anomaly detection frameworks, it follows a strict Safety-First architecture by design. However, users must independently verify that these features meet their specific regulatory requirements:

  • Zero Side Effects: Takes DataFrames of predictions + true values, returns anomaly scores + flags as DataFrames. Zero I/O, zero config files, zero data fetching.
  • Deterministic Logic: The scoring algorithms are designed to be purely mathematical and deterministic.
  • Fail-Safe Operation: The system is designed to favor explicit errors over silent failures when encountering invalid data.
  • EU AI Act Support: The architecture supports transparency and data governance, helping users build compliant high-risk AI components.
  • Minimal Dependencies: Only numpy, pandas, scikit-learn, and scipy — no unnecessary external packages.

For a detailed technical overview of our safety mechanisms, see MODEL_CARD.md.

Installation

uv add spotanomaly2-safe

Usage

from spotanomaly2_safe import ForecastingAnomalyDetector

detector = ForecastingAnomalyDetector(
    scorer_name="KMeansScorer",
    scorer_params={"n_clusters": 3},
    high_quantile=0.99,
    normalize_scores=True,
    normalization_quantile=0.99,
)
scores_df, flags_df = detector.fit_score_detect(
    y_true_train=train_true_df,
    y_pred_train=train_pred_df,
    y_true_test=test_true_df,
    y_pred_test=test_pred_df,
)

Disclaimer & Liability

IMPORTANT: This software is provided "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed.

In no event shall the authors, copyright holders, or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

The use of this software in safety-critical systems is at the sole risk of the user.

Documentation

Documentation (API) will be available at: https://sequential-parameter-optimization.github.io/spotanomaly2-safe/

Contributing

We welcome contributions to spotanomaly2-safe! Please read our CONTRIBUTING.md guide for details on:

  • Development setup and coding standards
  • Testing and documentation requirements
  • Commit message conventions
  • Pull request process
  • SPDX license header requirements

License

spotanomaly2-safe software: AGPL-3.0-or-later License

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

spotanomaly2_safe-0.1.0.tar.gz (144.4 kB view details)

Uploaded Source

Built Distribution

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

spotanomaly2_safe-0.1.0-py3-none-any.whl (32.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spotanomaly2_safe-0.1.0.tar.gz
  • Upload date:
  • Size: 144.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for spotanomaly2_safe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 642952bcd7277a7f252bd023312e2ef91256b9ad58493d5a42eaba887d2e678f
MD5 f09ac667d69689890f7cd4c443ddbe75
BLAKE2b-256 1d76acc04ffef2749ece5562f6cf2933e60600dbd4b5bd9b709d845a472a3df9

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotanomaly2_safe-0.1.0.tar.gz:

Publisher: release.yml on sequential-parameter-optimization/spotanomaly2-safe

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

File details

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

File metadata

File hashes

Hashes for spotanomaly2_safe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e293515feaf7b030dbb36f5deaabe6250430baeb1a15577d3979c77b70ab20a6
MD5 d869b5e1322d87926a68f306f979e144
BLAKE2b-256 a3319babd340c974596f0dc8c5a85fcd57e25c240b79b0734de6596407989b16

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotanomaly2_safe-0.1.0-py3-none-any.whl:

Publisher: release.yml on sequential-parameter-optimization/spotanomaly2-safe

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