anoscore 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anoscore-0.1.0/LICENSE +21 -0
- anoscore-0.1.0/PKG-INFO +178 -0
- anoscore-0.1.0/README.md +151 -0
- anoscore-0.1.0/pyproject.toml +80 -0
- anoscore-0.1.0/pyproject.toml.orig +83 -0
- anoscore-0.1.0/src/anoscore/__init__.py +84 -0
- anoscore-0.1.0/src/anoscore/__main__.py +16 -0
- anoscore-0.1.0/src/anoscore/adapters.py +27 -0
- anoscore-0.1.0/src/anoscore/calibration.py +46 -0
- anoscore-0.1.0/src/anoscore/cli/__init__.py +11 -0
- anoscore-0.1.0/src/anoscore/cli/_app.py +196 -0
- anoscore-0.1.0/src/anoscore/cli/_commands.py +153 -0
- anoscore-0.1.0/src/anoscore/cli/_io.py +200 -0
- anoscore-0.1.0/src/anoscore/compat/__init__.py +11 -0
- anoscore-0.1.0/src/anoscore/core/__init__.py +471 -0
- anoscore-0.1.0/src/anoscore/core/adapters.py +428 -0
- anoscore-0.1.0/src/anoscore/core/calibration/__init__.py +46 -0
- anoscore-0.1.0/src/anoscore/core/calibration/base.py +1749 -0
- anoscore-0.1.0/src/anoscore/core/compat/__init__.py +10 -0
- anoscore-0.1.0/src/anoscore/core/compat/base.py +294 -0
- anoscore-0.1.0/src/anoscore/core/detect.py +1302 -0
- anoscore-0.1.0/src/anoscore/core/diagnostics.py +367 -0
- anoscore-0.1.0/src/anoscore/core/limits.py +295 -0
- anoscore-0.1.0/src/anoscore/core/proactive/__init__.py +36 -0
- anoscore-0.1.0/src/anoscore/core/proactive/base.py +911 -0
- anoscore-0.1.0/src/anoscore/core/reactive/__init__.py +53 -0
- anoscore-0.1.0/src/anoscore/core/reactive/base.py +950 -0
- anoscore-0.1.0/src/anoscore/core/reactive/sequential.py +699 -0
- anoscore-0.1.0/src/anoscore/core/reference.py +112 -0
- anoscore-0.1.0/src/anoscore/core/score_all.py +337 -0
- anoscore-0.1.0/src/anoscore/core/tails/__init__.py +26 -0
- anoscore-0.1.0/src/anoscore/core/tails/base.py +633 -0
- anoscore-0.1.0/src/anoscore/detect.py +26 -0
- anoscore-0.1.0/src/anoscore/diagnostics.py +10 -0
- anoscore-0.1.0/src/anoscore/emit/__init__.py +10 -0
- anoscore-0.1.0/src/anoscore/emit/base.py +65 -0
- anoscore-0.1.0/src/anoscore/limits.py +10 -0
- anoscore-0.1.0/src/anoscore/policy.py +172 -0
- anoscore-0.1.0/src/anoscore/proactive.py +36 -0
- anoscore-0.1.0/src/anoscore/py.typed +0 -0
- anoscore-0.1.0/src/anoscore/reactive.py +50 -0
- anoscore-0.1.0/src/anoscore/reference.py +10 -0
- anoscore-0.1.0/src/anoscore/score_all.py +11 -0
- anoscore-0.1.0/src/anoscore/tails.py +27 -0
anoscore-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 foretide
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
anoscore-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: anoscore
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Quantile-forecast anomaly scoring for multivariate time series
|
|
5
|
+
Keywords: time-series,telemetry,foundation-models,anomaly-detection
|
|
6
|
+
Author: foretide
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Requires-Dist: numpy>=2.5.3
|
|
13
|
+
Requires-Dist: scipy>=1.18.1
|
|
14
|
+
Requires-Dist: pydantic>=2.13.4 ; extra == 'config'
|
|
15
|
+
Requires-Dist: pydantic-settings>=2.15.0 ; extra == 'config'
|
|
16
|
+
Requires-Dist: pandera[geopandas,pandas,polars]>=0.32.1 ; extra == 'dataframe'
|
|
17
|
+
Requires-Dist: polars ; extra == 'dataframe'
|
|
18
|
+
Requires-Python: >=3.14, <3.15
|
|
19
|
+
Project-URL: Homepage, https://github.com/foretide/anoscore
|
|
20
|
+
Project-URL: Documentation, https://github.com/foretide/anoscore#documentation
|
|
21
|
+
Project-URL: Repository, https://github.com/foretide/anoscore
|
|
22
|
+
Project-URL: Bug Tracker, https://github.com/foretide/anoscore/issues
|
|
23
|
+
Project-URL: Changelog, https://github.com/foretide/anoscore/blob/main/CHANGELOG.md
|
|
24
|
+
Provides-Extra: config
|
|
25
|
+
Provides-Extra: dataframe
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# anoscore
|
|
29
|
+
|
|
30
|
+
Quantile-forecast anomaly scoring. It reads the quantile grid a time-series
|
|
31
|
+
foundation model already produced, and returns an anomaly signal, a time to
|
|
32
|
+
threshold, and a time to limit reach — without ever calling a model.
|
|
33
|
+
|
|
34
|
+
[](https://pypi.org/project/anoscore/)
|
|
35
|
+
[](https://pypi.org/project/anoscore/)
|
|
36
|
+
[](https://github.com/astral-sh/ruff)
|
|
37
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
38
|
+
[](https://github.com/astral-sh/ty)
|
|
39
|
+
[](https://hypothesis.readthedocs.io/)
|
|
40
|
+
|
|
41
|
+
## Description
|
|
42
|
+
|
|
43
|
+
A time-series foundation model hands you quantiles; you need to decide whether
|
|
44
|
+
the observation that follows is anomalous, and how long you have before it
|
|
45
|
+
is not. That gap is usually filled with per-project glue: a transpose, a
|
|
46
|
+
guessed level set, a threshold picked by eye, rewritten every time the model
|
|
47
|
+
changes.
|
|
48
|
+
|
|
49
|
+
This package is that layer. It is a small library of pure functions over
|
|
50
|
+
quantile forecasts:
|
|
51
|
+
|
|
52
|
+
- **Adapters** — `from_chronos2`, `from_toto2`, `from_timesfm3` and
|
|
53
|
+
`from_array` normalise the three model layouts onto one
|
|
54
|
+
`QuantileForecast`. Levels are named, never inferred, and the quantile axis
|
|
55
|
+
is declared rather than assumed.
|
|
56
|
+
- **Reactive anomaly detection** — `ans.reactive` maps a forecast and an
|
|
57
|
+
observation to a score: `log_tail`, `interval_score`, `pinball`,
|
|
58
|
+
`quantile_depth`, `scaled_deviation`, `mahalanobis`, `rolling_pit_ks`,
|
|
59
|
+
`ewma_normal_score`, `cusum`, `e_value` and more. Higher means more anomalous,
|
|
60
|
+
everywhere.
|
|
61
|
+
- **Proactive anomaly detection** — `ans.proactive` reads risk off a forecast
|
|
62
|
+
*before* the sample arrives: `time_to_limit`, `cumulative_hazard`,
|
|
63
|
+
`limit_tail`, `revision`, `projected_slope` and the rest. Also written
|
|
64
|
+
*anomaly prediction*.
|
|
65
|
+
|
|
66
|
+
The split is on **input dependency**, not on horizon position: `y` is aligned
|
|
67
|
+
to the full grid, a step not yet observed is `NaN` and scores `NaN`, and no
|
|
68
|
+
code knows which steps have arrived — so which reading of time you are doing is
|
|
69
|
+
a caller convention, not a code invariant.
|
|
70
|
+
- **Calibration** — `ans.calibrate` fits a per-channel calibration artifact from
|
|
71
|
+
a nominal window, so a stated false-alarm rate is a measurement rather than a
|
|
72
|
+
guess. Limits are a required argument with no default; sentinel values are
|
|
73
|
+
declared by the caller, never guessed.
|
|
74
|
+
- **Detection** — `ans.detect` thresholds a score into events at a given rate
|
|
75
|
+
or cut, with alarm policies for deadband, on/off delay, suppression and
|
|
76
|
+
priority ordering. `ans.aggregate` and `reduce_horizon` fold events back to the
|
|
77
|
+
granularity you alert at. `Limits.priority` is stored on the `Limits` object and
|
|
78
|
+
is not currently carried onto events.
|
|
79
|
+
- **Diagnostics** — `ans.diagnostics.report` measures whether a channel's grid
|
|
80
|
+
is usable before you tune anything against it: crossing rate, saturation
|
|
81
|
+
rate, PIT uniformity per channel, and effective tail resolution.
|
|
82
|
+
- **Comparison** — `ans.score_all` maps every applicable scorer over one input
|
|
83
|
+
and reports the rest as not-applicable, rather than failing. Sequential
|
|
84
|
+
state is returned as a plain array, never held by the library.
|
|
85
|
+
|
|
86
|
+
It is not a forecasting library — it never calls a model. It is not a
|
|
87
|
+
benchmark harness and it is not an evaluation library; anything needing
|
|
88
|
+
ground-truth labels is out of scope.
|
|
89
|
+
|
|
90
|
+
## Installation
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
uv add anoscore
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Or work from a clone:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
git clone https://github.com/foretide/anoscore.git
|
|
100
|
+
cd anoscore && uv sync
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Quick start
|
|
104
|
+
|
|
105
|
+
A score in five lines. The forecast is a `(batch, variate, horizon, L)` grid on
|
|
106
|
+
a declared level set; the score comes back the same shape, with a higher number
|
|
107
|
+
meaning more anomalous.
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import numpy as np
|
|
111
|
+
import anoscore as ans
|
|
112
|
+
|
|
113
|
+
fc = ans.adapters.from_array(
|
|
114
|
+
levels=ans.LEVELS_9, values=np.broadcast_to(np.linspace(-1.3, 1.3, 9), (1, 1, 4, 9))
|
|
115
|
+
)
|
|
116
|
+
score = ans.reactive.scaled_deviation(
|
|
117
|
+
fc, np.array([0.0, 0.2, 1.5, 4.0]).reshape(1, 1, 4)
|
|
118
|
+
)
|
|
119
|
+
print(score.data)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
[[[0. 0.07692308 0.57692308 1.53846154]]]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Command line
|
|
127
|
+
|
|
128
|
+
Five subcommands, each a thin wrapper over the library function it names.
|
|
129
|
+
|
|
130
|
+
| Command | What it does |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `anoscore diagnose --fc F` | grid-quality diagnostics for a forecast |
|
|
133
|
+
| `anoscore calibrate --fc F --obs Y --out C` | fit a calibration artifact from a nominal window |
|
|
134
|
+
| `anoscore score --fc F --obs Y` | map every applicable scorer over one input |
|
|
135
|
+
| `anoscore detect --score S --rate 0.01` | threshold a score into events at a stated rate |
|
|
136
|
+
| `anoscore adapt --model chronos2 --input I` | normalise raw model output into a forecast |
|
|
137
|
+
|
|
138
|
+
`anoscore --help` lists them. There is no `benchmark` subcommand: comparing
|
|
139
|
+
foundation models is not something this package does.
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
Start with the quickstart for your audience:
|
|
144
|
+
|
|
145
|
+
- [Operations](https://github.com/foretide/anoscore/blob/main/docs/quickstart-operations.md) — alarms you can route, at a
|
|
146
|
+
defensible false-alarm rate.
|
|
147
|
+
- [Anomaly research](https://github.com/foretide/anoscore/blob/main/docs/quickstart-research.md) — every scorer compared
|
|
148
|
+
under identical conditions.
|
|
149
|
+
- [Prognostics](https://github.com/foretide/anoscore/blob/main/docs/quickstart-prognostics.md) — time to limit reach, with
|
|
150
|
+
its uncertainty.
|
|
151
|
+
|
|
152
|
+
Then:
|
|
153
|
+
|
|
154
|
+
- [Known defects](https://github.com/foretide/anoscore/blob/main/docs/known-defects.md) — diagnosed, deliberately unfixed
|
|
155
|
+
behaviour, with the reasoning and the options that were not taken.
|
|
156
|
+
- [Architecture](https://github.com/foretide/anoscore/blob/main/docs/architecture.md) — how the pieces fit.
|
|
157
|
+
- [API reference](https://github.com/foretide/anoscore/blob/main/docs/api.md) — generated from docstrings.
|
|
158
|
+
- [Development](https://github.com/foretide/anoscore/blob/main/docs/development.md) — local setup, tests and CI.
|
|
159
|
+
- [Deployment](https://github.com/foretide/anoscore/blob/main/docs/deployment.md) — packaging and release.
|
|
160
|
+
|
|
161
|
+
## Status and independence
|
|
162
|
+
|
|
163
|
+
This is an independent, personal open-source project. It is not endorsed by
|
|
164
|
+
Amazon (Chronos), Datadog (Toto), Google (TimesFM) or IBM (granite-tsfm), and
|
|
165
|
+
it is not affiliated with any of them. It reads the output those models
|
|
166
|
+
produce; it does not contain, ship or call them.
|
|
167
|
+
|
|
168
|
+
It is pre-1.0. The public API may still change, and the known defects are
|
|
169
|
+
listed rather than hidden.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
Released under the [MIT License](https://github.com/foretide/anoscore/blob/main/LICENSE).
|
|
174
|
+
|
|
175
|
+
## Contributing
|
|
176
|
+
|
|
177
|
+
Contributions are welcome. Read [CONTRIBUTING.md](https://github.com/foretide/anoscore/blob/main/CONTRIBUTING.md) first — it
|
|
178
|
+
covers the sign-off the project asks for and the gates every change must pass.
|
anoscore-0.1.0/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# anoscore
|
|
2
|
+
|
|
3
|
+
Quantile-forecast anomaly scoring. It reads the quantile grid a time-series
|
|
4
|
+
foundation model already produced, and returns an anomaly signal, a time to
|
|
5
|
+
threshold, and a time to limit reach — without ever calling a model.
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/anoscore/)
|
|
8
|
+
[](https://pypi.org/project/anoscore/)
|
|
9
|
+
[](https://github.com/astral-sh/ruff)
|
|
10
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
11
|
+
[](https://github.com/astral-sh/ty)
|
|
12
|
+
[](https://hypothesis.readthedocs.io/)
|
|
13
|
+
|
|
14
|
+
## Description
|
|
15
|
+
|
|
16
|
+
A time-series foundation model hands you quantiles; you need to decide whether
|
|
17
|
+
the observation that follows is anomalous, and how long you have before it
|
|
18
|
+
is not. That gap is usually filled with per-project glue: a transpose, a
|
|
19
|
+
guessed level set, a threshold picked by eye, rewritten every time the model
|
|
20
|
+
changes.
|
|
21
|
+
|
|
22
|
+
This package is that layer. It is a small library of pure functions over
|
|
23
|
+
quantile forecasts:
|
|
24
|
+
|
|
25
|
+
- **Adapters** — `from_chronos2`, `from_toto2`, `from_timesfm3` and
|
|
26
|
+
`from_array` normalise the three model layouts onto one
|
|
27
|
+
`QuantileForecast`. Levels are named, never inferred, and the quantile axis
|
|
28
|
+
is declared rather than assumed.
|
|
29
|
+
- **Reactive anomaly detection** — `ans.reactive` maps a forecast and an
|
|
30
|
+
observation to a score: `log_tail`, `interval_score`, `pinball`,
|
|
31
|
+
`quantile_depth`, `scaled_deviation`, `mahalanobis`, `rolling_pit_ks`,
|
|
32
|
+
`ewma_normal_score`, `cusum`, `e_value` and more. Higher means more anomalous,
|
|
33
|
+
everywhere.
|
|
34
|
+
- **Proactive anomaly detection** — `ans.proactive` reads risk off a forecast
|
|
35
|
+
*before* the sample arrives: `time_to_limit`, `cumulative_hazard`,
|
|
36
|
+
`limit_tail`, `revision`, `projected_slope` and the rest. Also written
|
|
37
|
+
*anomaly prediction*.
|
|
38
|
+
|
|
39
|
+
The split is on **input dependency**, not on horizon position: `y` is aligned
|
|
40
|
+
to the full grid, a step not yet observed is `NaN` and scores `NaN`, and no
|
|
41
|
+
code knows which steps have arrived — so which reading of time you are doing is
|
|
42
|
+
a caller convention, not a code invariant.
|
|
43
|
+
- **Calibration** — `ans.calibrate` fits a per-channel calibration artifact from
|
|
44
|
+
a nominal window, so a stated false-alarm rate is a measurement rather than a
|
|
45
|
+
guess. Limits are a required argument with no default; sentinel values are
|
|
46
|
+
declared by the caller, never guessed.
|
|
47
|
+
- **Detection** — `ans.detect` thresholds a score into events at a given rate
|
|
48
|
+
or cut, with alarm policies for deadband, on/off delay, suppression and
|
|
49
|
+
priority ordering. `ans.aggregate` and `reduce_horizon` fold events back to the
|
|
50
|
+
granularity you alert at. `Limits.priority` is stored on the `Limits` object and
|
|
51
|
+
is not currently carried onto events.
|
|
52
|
+
- **Diagnostics** — `ans.diagnostics.report` measures whether a channel's grid
|
|
53
|
+
is usable before you tune anything against it: crossing rate, saturation
|
|
54
|
+
rate, PIT uniformity per channel, and effective tail resolution.
|
|
55
|
+
- **Comparison** — `ans.score_all` maps every applicable scorer over one input
|
|
56
|
+
and reports the rest as not-applicable, rather than failing. Sequential
|
|
57
|
+
state is returned as a plain array, never held by the library.
|
|
58
|
+
|
|
59
|
+
It is not a forecasting library — it never calls a model. It is not a
|
|
60
|
+
benchmark harness and it is not an evaluation library; anything needing
|
|
61
|
+
ground-truth labels is out of scope.
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
uv add anoscore
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or work from a clone:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/foretide/anoscore.git
|
|
73
|
+
cd anoscore && uv sync
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick start
|
|
77
|
+
|
|
78
|
+
A score in five lines. The forecast is a `(batch, variate, horizon, L)` grid on
|
|
79
|
+
a declared level set; the score comes back the same shape, with a higher number
|
|
80
|
+
meaning more anomalous.
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import numpy as np
|
|
84
|
+
import anoscore as ans
|
|
85
|
+
|
|
86
|
+
fc = ans.adapters.from_array(
|
|
87
|
+
levels=ans.LEVELS_9, values=np.broadcast_to(np.linspace(-1.3, 1.3, 9), (1, 1, 4, 9))
|
|
88
|
+
)
|
|
89
|
+
score = ans.reactive.scaled_deviation(
|
|
90
|
+
fc, np.array([0.0, 0.2, 1.5, 4.0]).reshape(1, 1, 4)
|
|
91
|
+
)
|
|
92
|
+
print(score.data)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
[[[0. 0.07692308 0.57692308 1.53846154]]]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Command line
|
|
100
|
+
|
|
101
|
+
Five subcommands, each a thin wrapper over the library function it names.
|
|
102
|
+
|
|
103
|
+
| Command | What it does |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `anoscore diagnose --fc F` | grid-quality diagnostics for a forecast |
|
|
106
|
+
| `anoscore calibrate --fc F --obs Y --out C` | fit a calibration artifact from a nominal window |
|
|
107
|
+
| `anoscore score --fc F --obs Y` | map every applicable scorer over one input |
|
|
108
|
+
| `anoscore detect --score S --rate 0.01` | threshold a score into events at a stated rate |
|
|
109
|
+
| `anoscore adapt --model chronos2 --input I` | normalise raw model output into a forecast |
|
|
110
|
+
|
|
111
|
+
`anoscore --help` lists them. There is no `benchmark` subcommand: comparing
|
|
112
|
+
foundation models is not something this package does.
|
|
113
|
+
|
|
114
|
+
## Documentation
|
|
115
|
+
|
|
116
|
+
Start with the quickstart for your audience:
|
|
117
|
+
|
|
118
|
+
- [Operations](https://github.com/foretide/anoscore/blob/main/docs/quickstart-operations.md) — alarms you can route, at a
|
|
119
|
+
defensible false-alarm rate.
|
|
120
|
+
- [Anomaly research](https://github.com/foretide/anoscore/blob/main/docs/quickstart-research.md) — every scorer compared
|
|
121
|
+
under identical conditions.
|
|
122
|
+
- [Prognostics](https://github.com/foretide/anoscore/blob/main/docs/quickstart-prognostics.md) — time to limit reach, with
|
|
123
|
+
its uncertainty.
|
|
124
|
+
|
|
125
|
+
Then:
|
|
126
|
+
|
|
127
|
+
- [Known defects](https://github.com/foretide/anoscore/blob/main/docs/known-defects.md) — diagnosed, deliberately unfixed
|
|
128
|
+
behaviour, with the reasoning and the options that were not taken.
|
|
129
|
+
- [Architecture](https://github.com/foretide/anoscore/blob/main/docs/architecture.md) — how the pieces fit.
|
|
130
|
+
- [API reference](https://github.com/foretide/anoscore/blob/main/docs/api.md) — generated from docstrings.
|
|
131
|
+
- [Development](https://github.com/foretide/anoscore/blob/main/docs/development.md) — local setup, tests and CI.
|
|
132
|
+
- [Deployment](https://github.com/foretide/anoscore/blob/main/docs/deployment.md) — packaging and release.
|
|
133
|
+
|
|
134
|
+
## Status and independence
|
|
135
|
+
|
|
136
|
+
This is an independent, personal open-source project. It is not endorsed by
|
|
137
|
+
Amazon (Chronos), Datadog (Toto), Google (TimesFM) or IBM (granite-tsfm), and
|
|
138
|
+
it is not affiliated with any of them. It reads the output those models
|
|
139
|
+
produce; it does not contain, ship or call them.
|
|
140
|
+
|
|
141
|
+
It is pre-1.0. The public API may still change, and the known defects are
|
|
142
|
+
listed rather than hidden.
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
Released under the [MIT License](https://github.com/foretide/anoscore/blob/main/LICENSE).
|
|
147
|
+
|
|
148
|
+
## Contributing
|
|
149
|
+
|
|
150
|
+
Contributions are welcome. Read [CONTRIBUTING.md](https://github.com/foretide/anoscore/blob/main/CONTRIBUTING.md) first — it
|
|
151
|
+
covers the sign-off the project asks for and the gates every change must pass.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "anoscore"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Quantile-forecast anomaly scoring for multivariate time series"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.14,<3.15"
|
|
9
|
+
keywords = [
|
|
10
|
+
"time-series",
|
|
11
|
+
"telemetry",
|
|
12
|
+
"foundation-models",
|
|
13
|
+
"anomaly-detection",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3.14",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"numpy>=2.5.3",
|
|
22
|
+
"scipy>=1.18.1",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[[project.authors]]
|
|
26
|
+
name = "foretide"
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dataframe = [
|
|
30
|
+
"pandera[geopandas,pandas,polars]>=0.32.1",
|
|
31
|
+
"polars",
|
|
32
|
+
]
|
|
33
|
+
config = [
|
|
34
|
+
"pydantic>=2.13.4",
|
|
35
|
+
"pydantic-settings>=2.15.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/foretide/anoscore"
|
|
40
|
+
Documentation = "https://github.com/foretide/anoscore#documentation"
|
|
41
|
+
Repository = "https://github.com/foretide/anoscore"
|
|
42
|
+
"Bug Tracker" = "https://github.com/foretide/anoscore/issues"
|
|
43
|
+
Changelog = "https://github.com/foretide/anoscore/blob/main/CHANGELOG.md"
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
anoscore = "anoscore.__main__:main"
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["uv-build>=0.11,<0.14"]
|
|
50
|
+
build-backend = "uv_build"
|
|
51
|
+
|
|
52
|
+
[dependency-groups]
|
|
53
|
+
dev = [
|
|
54
|
+
"bandit>=1.9.4",
|
|
55
|
+
"griffe>=2.2.0",
|
|
56
|
+
"hypothesis>=6.165.10",
|
|
57
|
+
"matplotlib>=3.10.0",
|
|
58
|
+
"mkdocs-material>=9.7.7",
|
|
59
|
+
"mkdocstrings[python]>=1.0.6",
|
|
60
|
+
"pandera[pandas,polars]>=0.32.1",
|
|
61
|
+
"polars",
|
|
62
|
+
"pydantic>=2.13.4",
|
|
63
|
+
"pydantic-settings>=2.15.0",
|
|
64
|
+
"pytest>=9.1.1",
|
|
65
|
+
"pytest-cov>=7.1.0",
|
|
66
|
+
"pytest-mock>=3.15.1",
|
|
67
|
+
"pytest-xdist>=3.8.0",
|
|
68
|
+
"ruff>=0.16.3",
|
|
69
|
+
"ty>=0.0.72",
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.pytest.ini_options]
|
|
73
|
+
addopts = "--cov=anoscore --cov-report=term-missing"
|
|
74
|
+
|
|
75
|
+
[tool.uv]
|
|
76
|
+
index-url = "https://pypi.org/simple"
|
|
77
|
+
|
|
78
|
+
[[tool.uv.index]]
|
|
79
|
+
name = "pypi"
|
|
80
|
+
url = "https://pypi.org/simple"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "anoscore"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Quantile-forecast anomaly scoring for multivariate time series"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.14,<3.15"
|
|
9
|
+
keywords = ["time-series", "telemetry", "foundation-models", "anomaly-detection"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Programming Language :: Python :: 3.14",
|
|
14
|
+
]
|
|
15
|
+
authors = [
|
|
16
|
+
{name = "foretide"},
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"numpy>=2.5.3",
|
|
20
|
+
"scipy>=1.18.1",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
# DataFrame integrations used only by `.frame()` and the CLI.
|
|
25
|
+
dataframe = [
|
|
26
|
+
"pandera[geopandas,pandas,polars]>=0.32.1",
|
|
27
|
+
"polars",
|
|
28
|
+
]
|
|
29
|
+
# Typed configuration surface. Not needed by the numerical core.
|
|
30
|
+
config = [
|
|
31
|
+
"pydantic>=2.13.4",
|
|
32
|
+
"pydantic-settings>=2.15.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/foretide/anoscore"
|
|
37
|
+
Documentation = "https://github.com/foretide/anoscore#documentation"
|
|
38
|
+
Repository = "https://github.com/foretide/anoscore"
|
|
39
|
+
"Bug Tracker" = "https://github.com/foretide/anoscore/issues"
|
|
40
|
+
Changelog = "https://github.com/foretide/anoscore/blob/main/CHANGELOG.md"
|
|
41
|
+
|
|
42
|
+
[build-system]
|
|
43
|
+
requires = ["uv-build>=0.11,<0.14"]
|
|
44
|
+
build-backend = "uv_build"
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
anoscore = "anoscore.__main__:main"
|
|
48
|
+
|
|
49
|
+
[dependency-groups]
|
|
50
|
+
dev = [
|
|
51
|
+
"bandit>=1.9.4",
|
|
52
|
+
"griffe>=2.2.0",
|
|
53
|
+
"hypothesis>=6.165.10",
|
|
54
|
+
"matplotlib>=3.10.0",
|
|
55
|
+
"mkdocs-material>=9.7.7",
|
|
56
|
+
"mkdocstrings[python]>=1.0.6",
|
|
57
|
+
"pandera[pandas,polars]>=0.32.1",
|
|
58
|
+
"polars",
|
|
59
|
+
"pydantic>=2.13.4",
|
|
60
|
+
"pydantic-settings>=2.15.0",
|
|
61
|
+
"pytest>=9.1.1",
|
|
62
|
+
"pytest-cov>=7.1.0",
|
|
63
|
+
"pytest-mock>=3.15.1",
|
|
64
|
+
"pytest-xdist>=3.8.0",
|
|
65
|
+
"ruff>=0.16.3",
|
|
66
|
+
"ty>=0.0.72",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
# Coverage must stay active: tests/conftest.py fails closed without it.
|
|
71
|
+
addopts = "--cov=anoscore --cov-report=term-missing"
|
|
72
|
+
|
|
73
|
+
[tool.uv]
|
|
74
|
+
# Mirror configuration for air-gapped environments.
|
|
75
|
+
# Set UV_INDEX_URL env var to override (e.g., JFrog mirror).
|
|
76
|
+
# If not set, uv uses default PyPI.
|
|
77
|
+
index-url = "https://pypi.org/simple"
|
|
78
|
+
|
|
79
|
+
[[tool.uv.index]]
|
|
80
|
+
name = "pypi"
|
|
81
|
+
url = "https://pypi.org/simple"
|
|
82
|
+
# For air-gapped, override with:
|
|
83
|
+
# url = "https://your-jfrog-pypi-mirror/simple/"
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""anoscore: quantile-forecast anomaly scoring.
|
|
2
|
+
|
|
3
|
+
The UX reaches the package as ``ans``: scorers through ``ans.reactive`` and
|
|
4
|
+
``ans.proactive``, gridded results through ``ans.diagnostics``, ``ans.adapters``
|
|
5
|
+
and ``ans.reference``, and the pipeline verbs ``ans.calibrate``,
|
|
6
|
+
``ans.aggregate``, ``ans.detect`` and ``ans.score_all``. The latter two are the
|
|
7
|
+
callable functions at the package root (per UX.md); their modules stay
|
|
8
|
+
importable as ``from anoscore.detect import detect`` and
|
|
9
|
+
``importlib.import_module("anoscore.detect")``. Every public module is
|
|
10
|
+
NumPy-free at its own scope and re-exports its implementation from
|
|
11
|
+
``anoscore.core``.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from anoscore import (
|
|
15
|
+
adapters,
|
|
16
|
+
calibration,
|
|
17
|
+
compat,
|
|
18
|
+
diagnostics,
|
|
19
|
+
emit,
|
|
20
|
+
limits,
|
|
21
|
+
policy,
|
|
22
|
+
proactive,
|
|
23
|
+
reactive,
|
|
24
|
+
reference,
|
|
25
|
+
tails,
|
|
26
|
+
)
|
|
27
|
+
from anoscore.calibration import Calibration, calibrate
|
|
28
|
+
from anoscore.core.adapters import LEVELS_9, LEVELS_21
|
|
29
|
+
from anoscore.detect import (
|
|
30
|
+
AlarmPolicy,
|
|
31
|
+
AnomalyEvent,
|
|
32
|
+
EventSet,
|
|
33
|
+
aggregate,
|
|
34
|
+
detect,
|
|
35
|
+
reduce_horizon,
|
|
36
|
+
)
|
|
37
|
+
from anoscore.diagnostics import DiagnosticsReport
|
|
38
|
+
from anoscore.emit import register_format
|
|
39
|
+
from anoscore.limits import Limits
|
|
40
|
+
from anoscore.policy import AnoscoreWarning, get_policy, set_policy
|
|
41
|
+
from anoscore.reference import NominalGrid
|
|
42
|
+
from anoscore.score_all import ScoreSet, score_all
|
|
43
|
+
from anoscore.tails import GPD, Clip, Empirical, Exponential, Gaussian
|
|
44
|
+
|
|
45
|
+
__version__ = "0.1.0"
|
|
46
|
+
|
|
47
|
+
__all__ = [
|
|
48
|
+
"GPD",
|
|
49
|
+
"LEVELS_9",
|
|
50
|
+
"LEVELS_21",
|
|
51
|
+
"AlarmPolicy",
|
|
52
|
+
"AnomalyEvent",
|
|
53
|
+
"AnoscoreWarning",
|
|
54
|
+
"Calibration",
|
|
55
|
+
"Clip",
|
|
56
|
+
"DiagnosticsReport",
|
|
57
|
+
"Empirical",
|
|
58
|
+
"EventSet",
|
|
59
|
+
"Exponential",
|
|
60
|
+
"Gaussian",
|
|
61
|
+
"Limits",
|
|
62
|
+
"NominalGrid",
|
|
63
|
+
"ScoreSet",
|
|
64
|
+
"__version__",
|
|
65
|
+
"adapters",
|
|
66
|
+
"aggregate",
|
|
67
|
+
"calibrate",
|
|
68
|
+
"calibration",
|
|
69
|
+
"compat",
|
|
70
|
+
"detect",
|
|
71
|
+
"diagnostics",
|
|
72
|
+
"emit",
|
|
73
|
+
"get_policy",
|
|
74
|
+
"limits",
|
|
75
|
+
"policy",
|
|
76
|
+
"proactive",
|
|
77
|
+
"reactive",
|
|
78
|
+
"reduce_horizon",
|
|
79
|
+
"reference",
|
|
80
|
+
"register_format",
|
|
81
|
+
"score_all",
|
|
82
|
+
"set_policy",
|
|
83
|
+
"tails",
|
|
84
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
|
|
4
|
+
from anoscore.cli import _main
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from collections.abc import Sequence
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main(argv: Sequence[str] | None = None) -> int:
|
|
11
|
+
"""Dispatch to the CLI and return its exit code."""
|
|
12
|
+
return _main(argv)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
sys.exit(main())
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Public adapter shim.
|
|
2
|
+
|
|
3
|
+
Re-exports the adapter functions and level constants from
|
|
4
|
+
``anoscore.core.adapters``. This module imports no NumPy and no model package,
|
|
5
|
+
so ``import anoscore.adapters`` succeeds with no optional dependencies
|
|
6
|
+
installed (conformance item 92).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from anoscore.core.adapters import (
|
|
10
|
+
LEVELS_9,
|
|
11
|
+
LEVELS_21,
|
|
12
|
+
from_array,
|
|
13
|
+
from_chronos2,
|
|
14
|
+
from_chronos2_df,
|
|
15
|
+
from_timesfm3,
|
|
16
|
+
from_toto2,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"LEVELS_9",
|
|
21
|
+
"LEVELS_21",
|
|
22
|
+
"from_array",
|
|
23
|
+
"from_chronos2",
|
|
24
|
+
"from_chronos2_df",
|
|
25
|
+
"from_timesfm3",
|
|
26
|
+
"from_toto2",
|
|
27
|
+
]
|