Skip to content

sequential-parameter-optimization/spotanomaly2-safe

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

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages