noisefloor 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.
- noisefloor-0.1.0/.github/workflows/publish.yml +111 -0
- noisefloor-0.1.0/.github/workflows/test.yml +31 -0
- noisefloor-0.1.0/.gitignore +6 -0
- noisefloor-0.1.0/Dockerfile +8 -0
- noisefloor-0.1.0/LICENSE +21 -0
- noisefloor-0.1.0/PKG-INFO +146 -0
- noisefloor-0.1.0/README.md +123 -0
- noisefloor-0.1.0/glama.json +4 -0
- noisefloor-0.1.0/noisefloor/__init__.py +27 -0
- noisefloor-0.1.0/noisefloor/change.py +191 -0
- noisefloor-0.1.0/noisefloor/coverage.py +165 -0
- noisefloor-0.1.0/noisefloor/experiment.py +220 -0
- noisefloor-0.1.0/noisefloor/forecast.py +188 -0
- noisefloor-0.1.0/noisefloor/mcp_server.py +236 -0
- noisefloor-0.1.0/noisefloor/multiple.py +98 -0
- noisefloor-0.1.0/pyproject.toml +42 -0
- noisefloor-0.1.0/server.json +21 -0
- noisefloor-0.1.0/smithery.yaml +11 -0
- noisefloor-0.1.0/tests/test_calibration.py +131 -0
- noisefloor-0.1.0/tests/test_units.py +296 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Trusted Publishing: PyPI verifies this workflow's identity through GitHub's
|
|
4
|
+
# OIDC token, so no API token is ever created, stored or pasted anywhere. That
|
|
5
|
+
# removes the whole class of accident where a key ends up in a chat log, a shell
|
|
6
|
+
# history or a repo secret that nobody remembers rotating.
|
|
7
|
+
#
|
|
8
|
+
# One-time setup on PyPI (no secret to copy):
|
|
9
|
+
# https://pypi.org/manage/account/publishing/
|
|
10
|
+
# PyPI Project Name : noisefloor
|
|
11
|
+
# Owner : beepboop2025
|
|
12
|
+
# Repository name : noisefloor
|
|
13
|
+
# Workflow name : publish.yml
|
|
14
|
+
# Environment name : pypi
|
|
15
|
+
#
|
|
16
|
+
# Then publishing a release is: git tag v0.1.0 && git push origin v0.1.0
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
tags: ["v*"]
|
|
21
|
+
workflow_dispatch: {}
|
|
22
|
+
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
|
|
26
|
+
jobs:
|
|
27
|
+
test:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
31
|
+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.12"
|
|
34
|
+
- name: Install and test
|
|
35
|
+
run: |
|
|
36
|
+
python -m pip install --upgrade pip
|
|
37
|
+
pip install -e ".[dev]"
|
|
38
|
+
pytest -q
|
|
39
|
+
|
|
40
|
+
build:
|
|
41
|
+
needs: test
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
45
|
+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
|
46
|
+
with:
|
|
47
|
+
python-version: "3.12"
|
|
48
|
+
- name: Build wheel and sdist
|
|
49
|
+
run: |
|
|
50
|
+
python -m pip install --upgrade pip build
|
|
51
|
+
python -m build
|
|
52
|
+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
53
|
+
with:
|
|
54
|
+
name: dist
|
|
55
|
+
path: dist/
|
|
56
|
+
|
|
57
|
+
publish:
|
|
58
|
+
needs: build
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
environment: pypi
|
|
61
|
+
permissions:
|
|
62
|
+
id-token: write # the OIDC token that stands in for an API key
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
65
|
+
with:
|
|
66
|
+
name: dist
|
|
67
|
+
path: dist/
|
|
68
|
+
- uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
|
|
69
|
+
|
|
70
|
+
mcp-registry:
|
|
71
|
+
# The official MCP Registry also authenticates by GitHub OIDC, so this needs
|
|
72
|
+
# no secret either. PulseMCP re-ingests the official registry weekly, so
|
|
73
|
+
# landing here picks that listing up for free.
|
|
74
|
+
needs: publish
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
permissions:
|
|
77
|
+
id-token: write
|
|
78
|
+
contents: read
|
|
79
|
+
# never let a registry hiccup fail a release that already shipped to PyPI
|
|
80
|
+
continue-on-error: true
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
83
|
+
|
|
84
|
+
- name: Keep server.json version in step with the tag
|
|
85
|
+
# The tag reaches Python through the environment and is only ever handled
|
|
86
|
+
# as a string, so it is never interpolated into a shell command.
|
|
87
|
+
env:
|
|
88
|
+
TAG_NAME: ${{ github.ref_name }}
|
|
89
|
+
run: |
|
|
90
|
+
python - <<'PY'
|
|
91
|
+
import json, os, pathlib
|
|
92
|
+
version = os.environ["TAG_NAME"].lstrip("v")
|
|
93
|
+
path = pathlib.Path("server.json")
|
|
94
|
+
data = json.loads(path.read_text())
|
|
95
|
+
data["version"] = version
|
|
96
|
+
for package in data.get("packages", []):
|
|
97
|
+
package["version"] = version
|
|
98
|
+
path.write_text(json.dumps(data, indent=2) + "\n")
|
|
99
|
+
print("server.json version ->", version)
|
|
100
|
+
PY
|
|
101
|
+
|
|
102
|
+
- name: Install mcp-publisher
|
|
103
|
+
run: |
|
|
104
|
+
curl -sSL "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" \
|
|
105
|
+
| tar xz mcp-publisher
|
|
106
|
+
chmod +x mcp-publisher
|
|
107
|
+
|
|
108
|
+
- name: Authenticate by OIDC and publish
|
|
109
|
+
run: |
|
|
110
|
+
./mcp-publisher login github-oidc
|
|
111
|
+
./mcp-publisher publish
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
# The calibration tests are the product's central claims — that peeking is safe,
|
|
4
|
+
# that real effects are still found, that forecast ranges cover what they say.
|
|
5
|
+
# Running them on every push is what stops the README quietly becoming untrue.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
pull_request:
|
|
11
|
+
workflow_dispatch: {}
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
python-version: ["3.9", "3.12", "3.13"]
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
25
|
+
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
- run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -e ".[dev]"
|
|
31
|
+
pytest -q
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Minimal image: the package has zero runtime dependencies, so this is
|
|
2
|
+
# essentially just Python plus six source files.
|
|
3
|
+
FROM python:3.12-slim
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
6
|
+
COPY noisefloor ./noisefloor
|
|
7
|
+
RUN pip install --no-cache-dir .
|
|
8
|
+
ENTRYPOINT ["noisefloor-mcp"]
|
noisefloor-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 beepboop2025
|
|
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.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: noisefloor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Is this number real, or is it noise? Peek-safe A/B tests, change detection and honest forecasts. Zero dependencies.
|
|
5
|
+
Project-URL: Homepage, https://github.com/beepboop2025/noisefloor
|
|
6
|
+
Project-URL: Issues, https://github.com/beepboop2025/noisefloor/issues
|
|
7
|
+
Author: beepboop2025
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ab-testing,anomaly-detection,anytime-valid,calibration,change-detection,confidence-sequence,conformal-prediction,experimentation,mcp,monitoring,sequential-testing,statistics
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
17
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# noisefloor
|
|
25
|
+
|
|
26
|
+
**Is this number real, or is it noise?**
|
|
27
|
+
|
|
28
|
+
Zero dependencies. Standard library only. Works as a Python package or as an MCP server.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## The problem
|
|
33
|
+
|
|
34
|
+
You ship a change and check the A/B test. Then you check again an hour later. Then tomorrow. You stop when it looks like a win.
|
|
35
|
+
|
|
36
|
+
That procedure lies to you, and not by a little:
|
|
37
|
+
|
|
38
|
+
| 400 A/A tests, both arms identical, peeked every 20 observations | False winners |
|
|
39
|
+
|---|---|
|
|
40
|
+
| Two-proportion z-test | **40.2%** |
|
|
41
|
+
| noisefloor | **0.0%** |
|
|
42
|
+
|
|
43
|
+
Both arms had the *same* 10% conversion rate, so every "winner" was false. A test tuned to be wrong 5% of the time was wrong 40% of the time, purely because someone looked more than once.
|
|
44
|
+
|
|
45
|
+
This isn't a discipline problem. Peeking is the rational thing to do when a bad variant is costing money. It's a maths problem, and it has a solution.
|
|
46
|
+
|
|
47
|
+
Reproduce the table with `pytest tests/test_calibration.py`.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install noisefloor
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Use
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from noisefloor import experiment
|
|
59
|
+
|
|
60
|
+
experiment.compare(a_successes=500, a_total=5000,
|
|
61
|
+
b_successes=750, b_total=5000)
|
|
62
|
+
# {'decided': True, 'winner': 'B',
|
|
63
|
+
# 'reading': "B wins: its interval sits entirely above A's",
|
|
64
|
+
# 'A': {'rate': 0.1, 'interval': [0.08366, 0.11809]},
|
|
65
|
+
# 'B': {'rate': 0.15, 'interval': [0.13049, 0.17101]}, ...}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Run it after every single observation if you like. The guarantee holds at every sample size simultaneously, so stopping early, stopping late, or stopping because your manager walked past all cost you nothing.
|
|
69
|
+
|
|
70
|
+
### The other four checks
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from noisefloor import change, coverage, forecast, multiple
|
|
74
|
+
|
|
75
|
+
# Did this metric actually change? Catches collapses as well as spikes.
|
|
76
|
+
change.scan(daily_signups)
|
|
77
|
+
# {'state': 'changed', 'direction': 'down',
|
|
78
|
+
# 'reading': 'CHANGED (down), 8.5x its usual spread', ...}
|
|
79
|
+
|
|
80
|
+
# Did the metric move, or did my sample size move?
|
|
81
|
+
coverage.check(conversion_rate, sessions_per_day)
|
|
82
|
+
# {'verdict': 'SAMPLING_ARTIFACT',
|
|
83
|
+
# 'reading': 'your sample size changed by -41% at the same time and it tracks
|
|
84
|
+
# this metric historically (correlation 0.70)...'}
|
|
85
|
+
|
|
86
|
+
# What should the next reading be?
|
|
87
|
+
forecast.next_value(latency_p95)
|
|
88
|
+
|
|
89
|
+
# How good have these forecasts actually been?
|
|
90
|
+
forecast.score(latency_p95)
|
|
91
|
+
# {'empirical_coverage': 0.803, 'calibrated': True, 'n_misses': 197,
|
|
92
|
+
# 'worst_misses': [...]} # misses are always published
|
|
93
|
+
|
|
94
|
+
# I watch 40 metrics. Which genuinely stand out?
|
|
95
|
+
multiple.select({'signups': 3.2, 'latency': 812.0, 'errors': 1.1, ...})
|
|
96
|
+
# {'selected': ['latency'],
|
|
97
|
+
# 'reading': '1 of 40 metrics worth looking at: latency'}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## As an MCP server
|
|
101
|
+
|
|
102
|
+
Assistants read metrics constantly and assert significance the way people do — by eyeballing a change and calling it. This gives them a way to check.
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"mcpServers": {
|
|
107
|
+
"noisefloor": { "command": "uvx", "args": ["--from", "noisefloor", "noisefloor-mcp"] }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**MCP server name:** `io.github.beepboop2025/noisefloor`
|
|
113
|
+
|
|
114
|
+
Six tools: `ab_test`, `did_it_change`, `real_or_sampling`, `forecast_next`, `score_forecasts`, `which_metrics_matter`.
|
|
115
|
+
|
|
116
|
+
## Why these methods
|
|
117
|
+
|
|
118
|
+
Every check is **anytime-valid** or **distribution-free** — the two properties that survive contact with how dashboards are really used: looked at whenever someone feels like it, and stopped when they see what they want.
|
|
119
|
+
|
|
120
|
+
- **`experiment`** — beta-binomial mixture test martingale. A mixture of likelihood ratios is a non-negative martingale under the null, so Ville's inequality bounds the chance it *ever* crosses `1/alpha`. Exact for Bernoulli outcomes rather than a worst-case bound, which is where the power comes from. ([theory](https://arxiv.org/abs/2210.01948), [safe testing](https://arxiv.org/abs/1906.07801))
|
|
121
|
+
- **`change`** — conformal Shiryaev-Roberts detector. Rank-based p-values, no distributional assumption, with a stated average time between false alarms. Two-sided by default, because half of what goes wrong is a number going to zero. ([nonexchangeable conformal](https://arxiv.org/abs/2202.13415))
|
|
122
|
+
- **`coverage`** — conditions the metric on its own denominator. Almost every metric worth watching is a rate over a sample you don't control.
|
|
123
|
+
- **`forecast`** — adaptive conformal intervals, valid under arbitrary distribution shift, graded by the Weighted Interval Score, a *proper* rule so the scoreboard can't be gamed by hedging. ([ACI](https://arxiv.org/abs/2106.00170), [decaying steps](https://arxiv.org/abs/2402.01139), [WIS](https://arxiv.org/abs/2005.12881))
|
|
124
|
+
- **`multiple`** — e-Benjamini-Hochberg. Controls false discoveries across all your metrics at once, under *arbitrary dependence* — which matters, because real metrics move together. ([e-BH](https://arxiv.org/abs/2009.02824), [merging](https://arxiv.org/abs/1912.06116))
|
|
125
|
+
|
|
126
|
+
## What it costs
|
|
127
|
+
|
|
128
|
+
Anytime validity isn't free. At any fixed sample size the interval is wider than a one-look interval, so calling the same effect takes roughly twice the data — 10% vs 13% resolves at a median of about 14,300 observations here, against roughly 7,000 for a correctly run one-look test.
|
|
129
|
+
|
|
130
|
+
You're buying the right to stop whenever you want. For most teams that's a bargain, because the realistic alternative isn't a clean one-look test. It's a one-look test being peeked at, which is the 40% column above.
|
|
131
|
+
|
|
132
|
+
## Design
|
|
133
|
+
|
|
134
|
+
Nothing here returns a number it can't stand behind. Not enough history returns `NOT_ENOUGH_HISTORY`, not a confident zero. A metric that moved with its own sample size returns `SAMPLING_ARTIFACT`, not a finding. Forecast misses are published in full and there's no flag to hide them.
|
|
135
|
+
|
|
136
|
+
Every result carries its `method` and, where one exists, its `guarantee`. Quote them — the point is that the claim can be backed rather than asserted.
|
|
137
|
+
|
|
138
|
+
Zero dependencies means it installs in Lambda, edge runtimes and locked-down build images where adding scipy is a procurement conversation. Every result is deterministic: same input, same answer, forever, with no RNG anywhere.
|
|
139
|
+
|
|
140
|
+
## Provenance
|
|
141
|
+
|
|
142
|
+
These engines were built for [Palimpsest](https://palimpsest.info), a public-good censorship observatory, where publishing a number you can't defend is the whole failure mode. The sampling-artifact check exists because a censorship index there fell 60.3 → 55.6 while the measurements underneath it fell 353,676 → 208,933. The index hadn't moved. The instrument had.
|
|
143
|
+
|
|
144
|
+
## Licence
|
|
145
|
+
|
|
146
|
+
MIT.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# noisefloor
|
|
2
|
+
|
|
3
|
+
**Is this number real, or is it noise?**
|
|
4
|
+
|
|
5
|
+
Zero dependencies. Standard library only. Works as a Python package or as an MCP server.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The problem
|
|
10
|
+
|
|
11
|
+
You ship a change and check the A/B test. Then you check again an hour later. Then tomorrow. You stop when it looks like a win.
|
|
12
|
+
|
|
13
|
+
That procedure lies to you, and not by a little:
|
|
14
|
+
|
|
15
|
+
| 400 A/A tests, both arms identical, peeked every 20 observations | False winners |
|
|
16
|
+
|---|---|
|
|
17
|
+
| Two-proportion z-test | **40.2%** |
|
|
18
|
+
| noisefloor | **0.0%** |
|
|
19
|
+
|
|
20
|
+
Both arms had the *same* 10% conversion rate, so every "winner" was false. A test tuned to be wrong 5% of the time was wrong 40% of the time, purely because someone looked more than once.
|
|
21
|
+
|
|
22
|
+
This isn't a discipline problem. Peeking is the rational thing to do when a bad variant is costing money. It's a maths problem, and it has a solution.
|
|
23
|
+
|
|
24
|
+
Reproduce the table with `pytest tests/test_calibration.py`.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install noisefloor
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Use
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from noisefloor import experiment
|
|
36
|
+
|
|
37
|
+
experiment.compare(a_successes=500, a_total=5000,
|
|
38
|
+
b_successes=750, b_total=5000)
|
|
39
|
+
# {'decided': True, 'winner': 'B',
|
|
40
|
+
# 'reading': "B wins: its interval sits entirely above A's",
|
|
41
|
+
# 'A': {'rate': 0.1, 'interval': [0.08366, 0.11809]},
|
|
42
|
+
# 'B': {'rate': 0.15, 'interval': [0.13049, 0.17101]}, ...}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Run it after every single observation if you like. The guarantee holds at every sample size simultaneously, so stopping early, stopping late, or stopping because your manager walked past all cost you nothing.
|
|
46
|
+
|
|
47
|
+
### The other four checks
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from noisefloor import change, coverage, forecast, multiple
|
|
51
|
+
|
|
52
|
+
# Did this metric actually change? Catches collapses as well as spikes.
|
|
53
|
+
change.scan(daily_signups)
|
|
54
|
+
# {'state': 'changed', 'direction': 'down',
|
|
55
|
+
# 'reading': 'CHANGED (down), 8.5x its usual spread', ...}
|
|
56
|
+
|
|
57
|
+
# Did the metric move, or did my sample size move?
|
|
58
|
+
coverage.check(conversion_rate, sessions_per_day)
|
|
59
|
+
# {'verdict': 'SAMPLING_ARTIFACT',
|
|
60
|
+
# 'reading': 'your sample size changed by -41% at the same time and it tracks
|
|
61
|
+
# this metric historically (correlation 0.70)...'}
|
|
62
|
+
|
|
63
|
+
# What should the next reading be?
|
|
64
|
+
forecast.next_value(latency_p95)
|
|
65
|
+
|
|
66
|
+
# How good have these forecasts actually been?
|
|
67
|
+
forecast.score(latency_p95)
|
|
68
|
+
# {'empirical_coverage': 0.803, 'calibrated': True, 'n_misses': 197,
|
|
69
|
+
# 'worst_misses': [...]} # misses are always published
|
|
70
|
+
|
|
71
|
+
# I watch 40 metrics. Which genuinely stand out?
|
|
72
|
+
multiple.select({'signups': 3.2, 'latency': 812.0, 'errors': 1.1, ...})
|
|
73
|
+
# {'selected': ['latency'],
|
|
74
|
+
# 'reading': '1 of 40 metrics worth looking at: latency'}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## As an MCP server
|
|
78
|
+
|
|
79
|
+
Assistants read metrics constantly and assert significance the way people do — by eyeballing a change and calling it. This gives them a way to check.
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"noisefloor": { "command": "uvx", "args": ["--from", "noisefloor", "noisefloor-mcp"] }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**MCP server name:** `io.github.beepboop2025/noisefloor`
|
|
90
|
+
|
|
91
|
+
Six tools: `ab_test`, `did_it_change`, `real_or_sampling`, `forecast_next`, `score_forecasts`, `which_metrics_matter`.
|
|
92
|
+
|
|
93
|
+
## Why these methods
|
|
94
|
+
|
|
95
|
+
Every check is **anytime-valid** or **distribution-free** — the two properties that survive contact with how dashboards are really used: looked at whenever someone feels like it, and stopped when they see what they want.
|
|
96
|
+
|
|
97
|
+
- **`experiment`** — beta-binomial mixture test martingale. A mixture of likelihood ratios is a non-negative martingale under the null, so Ville's inequality bounds the chance it *ever* crosses `1/alpha`. Exact for Bernoulli outcomes rather than a worst-case bound, which is where the power comes from. ([theory](https://arxiv.org/abs/2210.01948), [safe testing](https://arxiv.org/abs/1906.07801))
|
|
98
|
+
- **`change`** — conformal Shiryaev-Roberts detector. Rank-based p-values, no distributional assumption, with a stated average time between false alarms. Two-sided by default, because half of what goes wrong is a number going to zero. ([nonexchangeable conformal](https://arxiv.org/abs/2202.13415))
|
|
99
|
+
- **`coverage`** — conditions the metric on its own denominator. Almost every metric worth watching is a rate over a sample you don't control.
|
|
100
|
+
- **`forecast`** — adaptive conformal intervals, valid under arbitrary distribution shift, graded by the Weighted Interval Score, a *proper* rule so the scoreboard can't be gamed by hedging. ([ACI](https://arxiv.org/abs/2106.00170), [decaying steps](https://arxiv.org/abs/2402.01139), [WIS](https://arxiv.org/abs/2005.12881))
|
|
101
|
+
- **`multiple`** — e-Benjamini-Hochberg. Controls false discoveries across all your metrics at once, under *arbitrary dependence* — which matters, because real metrics move together. ([e-BH](https://arxiv.org/abs/2009.02824), [merging](https://arxiv.org/abs/1912.06116))
|
|
102
|
+
|
|
103
|
+
## What it costs
|
|
104
|
+
|
|
105
|
+
Anytime validity isn't free. At any fixed sample size the interval is wider than a one-look interval, so calling the same effect takes roughly twice the data — 10% vs 13% resolves at a median of about 14,300 observations here, against roughly 7,000 for a correctly run one-look test.
|
|
106
|
+
|
|
107
|
+
You're buying the right to stop whenever you want. For most teams that's a bargain, because the realistic alternative isn't a clean one-look test. It's a one-look test being peeked at, which is the 40% column above.
|
|
108
|
+
|
|
109
|
+
## Design
|
|
110
|
+
|
|
111
|
+
Nothing here returns a number it can't stand behind. Not enough history returns `NOT_ENOUGH_HISTORY`, not a confident zero. A metric that moved with its own sample size returns `SAMPLING_ARTIFACT`, not a finding. Forecast misses are published in full and there's no flag to hide them.
|
|
112
|
+
|
|
113
|
+
Every result carries its `method` and, where one exists, its `guarantee`. Quote them — the point is that the claim can be backed rather than asserted.
|
|
114
|
+
|
|
115
|
+
Zero dependencies means it installs in Lambda, edge runtimes and locked-down build images where adding scipy is a procurement conversation. Every result is deterministic: same input, same answer, forever, with no RNG anywhere.
|
|
116
|
+
|
|
117
|
+
## Provenance
|
|
118
|
+
|
|
119
|
+
These engines were built for [Palimpsest](https://palimpsest.info), a public-good censorship observatory, where publishing a number you can't defend is the whole failure mode. The sampling-artifact check exists because a censorship index there fell 60.3 → 55.6 while the measurements underneath it fell 353,676 → 208,933. The index hadn't moved. The instrument had.
|
|
120
|
+
|
|
121
|
+
## Licence
|
|
122
|
+
|
|
123
|
+
MIT.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""noisefloor — is this number real, or is it noise?
|
|
2
|
+
|
|
3
|
+
Five checks that answer the questions people actually argue about in dashboard
|
|
4
|
+
reviews and experiment readouts:
|
|
5
|
+
|
|
6
|
+
experiment.compare can I call a winner on this A/B test yet?
|
|
7
|
+
(safe to check as often as you like)
|
|
8
|
+
change.scan did this metric actually change, or is it noise?
|
|
9
|
+
coverage.check did the metric move, or did my sample size move?
|
|
10
|
+
forecast.next_value what should the next reading be, and within what range?
|
|
11
|
+
forecast.score how good have these forecasts actually been?
|
|
12
|
+
multiple.select I watch 40 metrics; which ones genuinely stand out?
|
|
13
|
+
|
|
14
|
+
Every method is anytime-valid or distribution-free, which is the property that
|
|
15
|
+
survives contact with how people really use dashboards: looking whenever they
|
|
16
|
+
feel like it, and stopping when they see what they want.
|
|
17
|
+
|
|
18
|
+
ZERO DEPENDENCIES. Standard library only, no numpy, no scipy. It installs
|
|
19
|
+
anywhere Python does — lambda functions, edge runtimes, locked-down build
|
|
20
|
+
images — and every result is deterministic and reproducible.
|
|
21
|
+
"""
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
from . import change, coverage, experiment, forecast, multiple
|
|
25
|
+
|
|
26
|
+
__version__ = "0.1.0"
|
|
27
|
+
__all__ = ["change", "coverage", "experiment", "forecast", "multiple"]
|