poseres 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.
- poseres-0.1.0/LICENSE +21 -0
- poseres-0.1.0/PKG-INFO +104 -0
- poseres-0.1.0/README.md +85 -0
- poseres-0.1.0/pyproject.toml +41 -0
- poseres-0.1.0/setup.cfg +4 -0
- poseres-0.1.0/src/poseres.egg-info/PKG-INFO +104 -0
- poseres-0.1.0/src/poseres.egg-info/SOURCES.txt +40 -0
- poseres-0.1.0/src/poseres.egg-info/dependency_links.txt +1 -0
- poseres-0.1.0/src/poseres.egg-info/entry_points.txt +2 -0
- poseres-0.1.0/src/poseres.egg-info/requires.txt +5 -0
- poseres-0.1.0/src/poseres.egg-info/top_level.txt +1 -0
- poseres-0.1.0/src/pra/__init__.py +26 -0
- poseres-0.1.0/src/pra/action/__init__.py +1 -0
- poseres-0.1.0/src/pra/action/policy.py +98 -0
- poseres-0.1.0/src/pra/anatomy/__init__.py +1 -0
- poseres-0.1.0/src/pra/anatomy/body.py +239 -0
- poseres-0.1.0/src/pra/config.py +244 -0
- poseres-0.1.0/src/pra/core/__init__.py +1 -0
- poseres-0.1.0/src/pra/core/bus.py +71 -0
- poseres-0.1.0/src/pra/core/contracts.py +95 -0
- poseres-0.1.0/src/pra/core/engine.py +519 -0
- poseres-0.1.0/src/pra/core/frame.py +542 -0
- poseres-0.1.0/src/pra/core/policies.py +146 -0
- poseres-0.1.0/src/pra/core/scorer.py +63 -0
- poseres-0.1.0/src/pra/harness/__init__.py +1 -0
- poseres-0.1.0/src/pra/harness/acceptance.py +328 -0
- poseres-0.1.0/src/pra/harness/agency.py +93 -0
- poseres-0.1.0/src/pra/harness/cli.py +251 -0
- poseres-0.1.0/src/pra/harness/report.py +320 -0
- poseres-0.1.0/src/pra/harness/runner.py +162 -0
- poseres-0.1.0/src/pra/harness/scale.py +85 -0
- poseres-0.1.0/src/pra/harness/scan.py +174 -0
- poseres-0.1.0/src/pra/motivation/__init__.py +1 -0
- poseres-0.1.0/src/pra/motivation/context.py +26 -0
- poseres-0.1.0/src/pra/motivation/drive.py +188 -0
- poseres-0.1.0/src/pra/persistence/__init__.py +1 -0
- poseres-0.1.0/src/pra/persistence/snapshot.py +204 -0
- poseres-0.1.0/src/pra/persistence/store.py +106 -0
- poseres-0.1.0/src/pra/telemetry/__init__.py +1 -0
- poseres-0.1.0/src/pra/telemetry/recorder.py +162 -0
- poseres-0.1.0/src/pra/world/__init__.py +1 -0
- poseres-0.1.0/src/pra/world/event_source.py +107 -0
poseres-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daan Gerits
|
|
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.
|
poseres-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: poseres
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pose Resolution Architecture — validation harness and batched in-memory core
|
|
5
|
+
Author: Daan Gerits
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/impire-io/poseres
|
|
8
|
+
Project-URL: Source, https://github.com/impire-io/poseres
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/impire-io/poseres/issues
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Requires-Python: >=3.13
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy>=2.4
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# PRA — Pose Resolution Architecture
|
|
21
|
+
|
|
22
|
+
An in-memory, batched, deterministic core (PRA-01) and the validation harness
|
|
23
|
+
(PRA-02) that runs the acceptance suite **T1–T6** plus the investigatory
|
|
24
|
+
**T-SCALE**, emitting an honest, reproducible PASS/FAIL verdict per test.
|
|
25
|
+
|
|
26
|
+
See `specs/001-validation-harness/` for the spec, plan, and contracts, and
|
|
27
|
+
`design/` for the architecture documents. The behavioral oracle is
|
|
28
|
+
`design/validate/pra_sim_v4.py`.
|
|
29
|
+
|
|
30
|
+
## Quickstart
|
|
31
|
+
|
|
32
|
+
**Fastest — install from PyPI with [`uv`](https://docs.astral.sh/uv/):**
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uvx --from poseres pra-validate suite
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
No Python version juggling, no venv to manage. `uv` fetches Python 3.13 automatically if you don't have it.
|
|
39
|
+
|
|
40
|
+
**From source:**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/impire-io/poseres.git
|
|
44
|
+
cd pra
|
|
45
|
+
python3.13 -m venv .venv
|
|
46
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
47
|
+
pip install -e ".[dev]" # numpy + pytest + ruff
|
|
48
|
+
|
|
49
|
+
pra-validate suite # 8 seeds, true_dim=3, checkpoints 18/30/50
|
|
50
|
+
pra-validate suite --json out/report.json
|
|
51
|
+
pra-validate determinism --seed 1 # byte-identical re-run check
|
|
52
|
+
pra-validate scale --true-dims 20,35,50
|
|
53
|
+
pra-validate scan --true-dim 20 --hidden-sizes 12,32,64 # diagnostic dimension scan
|
|
54
|
+
pra-validate agency # curious vs random (T7) + value-signal telemetry
|
|
55
|
+
|
|
56
|
+
ruff format --check . && ruff check . && pytest -q
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Independent seeds run in parallel worker processes by default (`--workers`,
|
|
60
|
+
0 = one per seed up to the CPU count) — parallelism never changes results
|
|
61
|
+
(byte-identical to sequential; each run keeps its own seeded, single-threaded
|
|
62
|
+
pipeline). The full default suite runs in ~20s on a 14-core machine.
|
|
63
|
+
|
|
64
|
+
`suite` emits, for each of **T1–T6**, the measured aggregate (mean ± std), the
|
|
65
|
+
exact pass criterion, and PASS/FAIL. **T4** is shown as the full per-seed `best_dim`
|
|
66
|
+
spread at every horizon checkpoint and PASSes only if the within-one-of-true
|
|
67
|
+
majority holds at *every* checkpoint — it can never pass on a lucky single horizon.
|
|
68
|
+
**T5** PASSes only when the population genuinely self-limits (no seed strictly
|
|
69
|
+
growing over its final third), not merely because it hit a cap. A single-seed run is
|
|
70
|
+
labelled **FOR DEBUGGING ONLY**. Exit code is 0 even when a test FAILs (a FAIL is
|
|
71
|
+
data, not a CLI error) unless `--strict` is passed.
|
|
72
|
+
|
|
73
|
+
## Governing principle — honest summary
|
|
74
|
+
|
|
75
|
+
Where a tidy report and a faithful one conflict, the faithful one wins (FR-008): a
|
|
76
|
+
failing test is shown as FAIL *with the numbers that explain it*; a test needing a
|
|
77
|
+
spread is never reported by its mean alone; a seed that errors is surfaced and the
|
|
78
|
+
aggregate flagged incomplete, never silently dropped; too few samples reads
|
|
79
|
+
"not available", never a fabricated number. Two runs of a seed produce
|
|
80
|
+
byte-identical telemetry (single seeded RNG, fixed draw order, single-threaded BLAS).
|
|
81
|
+
|
|
82
|
+
## Layout
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
src/pra/
|
|
86
|
+
config.py # every PRA-01 §8 parameter + validation
|
|
87
|
+
world/event_source.py# EventSource seam + SensorimotorWorld (nonlinear, hidden latent)
|
|
88
|
+
core/ # contracts, bus, scorer, policies, the batched FrameGroup kernel, engine
|
|
89
|
+
motivation/ # Drive seam: curiosity (learning progress + novelty), weighted drive set
|
|
90
|
+
action/ # Policy seam: pinned random baseline + one-step curiosity lookahead
|
|
91
|
+
persistence/ # snapshot/restore: versioned blob + atomic SnapshotStore (opt-in)
|
|
92
|
+
anatomy/ # body: sensors/actuators, fixed-order composition, runtime tools
|
|
93
|
+
telemetry/recorder.py# deterministic per-seed summary
|
|
94
|
+
harness/ # acceptance (T1-T7/T-SCALE), runner, report, cli, scale, scan, agency
|
|
95
|
+
tests/ # unit (incl. batched-vs-reference proof) / contract (5 seams) / integration
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Behavioral oracle
|
|
99
|
+
|
|
100
|
+
`design/validate/pra_sim_v4.py` is the validated reference run. The batched core
|
|
101
|
+
reproduces its T1–T6 trajectory at the default config (the per-frame-vs-batched
|
|
102
|
+
equivalence is enforced by `tests/unit/test_batched_equivalence.py`) at roughly 40×
|
|
103
|
+
the speed. The full default suite (8 seeds × predictive + ablation × 50 cycles)
|
|
104
|
+
completes in well under a minute.
|
poseres-0.1.0/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# PRA — Pose Resolution Architecture
|
|
2
|
+
|
|
3
|
+
An in-memory, batched, deterministic core (PRA-01) and the validation harness
|
|
4
|
+
(PRA-02) that runs the acceptance suite **T1–T6** plus the investigatory
|
|
5
|
+
**T-SCALE**, emitting an honest, reproducible PASS/FAIL verdict per test.
|
|
6
|
+
|
|
7
|
+
See `specs/001-validation-harness/` for the spec, plan, and contracts, and
|
|
8
|
+
`design/` for the architecture documents. The behavioral oracle is
|
|
9
|
+
`design/validate/pra_sim_v4.py`.
|
|
10
|
+
|
|
11
|
+
## Quickstart
|
|
12
|
+
|
|
13
|
+
**Fastest — install from PyPI with [`uv`](https://docs.astral.sh/uv/):**
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
uvx --from poseres pra-validate suite
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
No Python version juggling, no venv to manage. `uv` fetches Python 3.13 automatically if you don't have it.
|
|
20
|
+
|
|
21
|
+
**From source:**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/impire-io/poseres.git
|
|
25
|
+
cd pra
|
|
26
|
+
python3.13 -m venv .venv
|
|
27
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
28
|
+
pip install -e ".[dev]" # numpy + pytest + ruff
|
|
29
|
+
|
|
30
|
+
pra-validate suite # 8 seeds, true_dim=3, checkpoints 18/30/50
|
|
31
|
+
pra-validate suite --json out/report.json
|
|
32
|
+
pra-validate determinism --seed 1 # byte-identical re-run check
|
|
33
|
+
pra-validate scale --true-dims 20,35,50
|
|
34
|
+
pra-validate scan --true-dim 20 --hidden-sizes 12,32,64 # diagnostic dimension scan
|
|
35
|
+
pra-validate agency # curious vs random (T7) + value-signal telemetry
|
|
36
|
+
|
|
37
|
+
ruff format --check . && ruff check . && pytest -q
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Independent seeds run in parallel worker processes by default (`--workers`,
|
|
41
|
+
0 = one per seed up to the CPU count) — parallelism never changes results
|
|
42
|
+
(byte-identical to sequential; each run keeps its own seeded, single-threaded
|
|
43
|
+
pipeline). The full default suite runs in ~20s on a 14-core machine.
|
|
44
|
+
|
|
45
|
+
`suite` emits, for each of **T1–T6**, the measured aggregate (mean ± std), the
|
|
46
|
+
exact pass criterion, and PASS/FAIL. **T4** is shown as the full per-seed `best_dim`
|
|
47
|
+
spread at every horizon checkpoint and PASSes only if the within-one-of-true
|
|
48
|
+
majority holds at *every* checkpoint — it can never pass on a lucky single horizon.
|
|
49
|
+
**T5** PASSes only when the population genuinely self-limits (no seed strictly
|
|
50
|
+
growing over its final third), not merely because it hit a cap. A single-seed run is
|
|
51
|
+
labelled **FOR DEBUGGING ONLY**. Exit code is 0 even when a test FAILs (a FAIL is
|
|
52
|
+
data, not a CLI error) unless `--strict` is passed.
|
|
53
|
+
|
|
54
|
+
## Governing principle — honest summary
|
|
55
|
+
|
|
56
|
+
Where a tidy report and a faithful one conflict, the faithful one wins (FR-008): a
|
|
57
|
+
failing test is shown as FAIL *with the numbers that explain it*; a test needing a
|
|
58
|
+
spread is never reported by its mean alone; a seed that errors is surfaced and the
|
|
59
|
+
aggregate flagged incomplete, never silently dropped; too few samples reads
|
|
60
|
+
"not available", never a fabricated number. Two runs of a seed produce
|
|
61
|
+
byte-identical telemetry (single seeded RNG, fixed draw order, single-threaded BLAS).
|
|
62
|
+
|
|
63
|
+
## Layout
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
src/pra/
|
|
67
|
+
config.py # every PRA-01 §8 parameter + validation
|
|
68
|
+
world/event_source.py# EventSource seam + SensorimotorWorld (nonlinear, hidden latent)
|
|
69
|
+
core/ # contracts, bus, scorer, policies, the batched FrameGroup kernel, engine
|
|
70
|
+
motivation/ # Drive seam: curiosity (learning progress + novelty), weighted drive set
|
|
71
|
+
action/ # Policy seam: pinned random baseline + one-step curiosity lookahead
|
|
72
|
+
persistence/ # snapshot/restore: versioned blob + atomic SnapshotStore (opt-in)
|
|
73
|
+
anatomy/ # body: sensors/actuators, fixed-order composition, runtime tools
|
|
74
|
+
telemetry/recorder.py# deterministic per-seed summary
|
|
75
|
+
harness/ # acceptance (T1-T7/T-SCALE), runner, report, cli, scale, scan, agency
|
|
76
|
+
tests/ # unit (incl. batched-vs-reference proof) / contract (5 seams) / integration
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Behavioral oracle
|
|
80
|
+
|
|
81
|
+
`design/validate/pra_sim_v4.py` is the validated reference run. The batched core
|
|
82
|
+
reproduces its T1–T6 trajectory at the default config (the per-frame-vs-batched
|
|
83
|
+
equivalence is enforced by `tests/unit/test_batched_equivalence.py`) at roughly 40×
|
|
84
|
+
the speed. The full default suite (8 seeds × predictive + ablation × 50 cycles)
|
|
85
|
+
completes in well under a minute.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "poseres"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Pose Resolution Architecture — validation harness and batched in-memory core"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.13"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
classifiers = ["License :: OSI Approved :: MIT License"]
|
|
13
|
+
authors = [{ name = "Daan Gerits" }]
|
|
14
|
+
dependencies = ["numpy>=2.4"]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Homepage = "https://github.com/impire-io/poseres"
|
|
18
|
+
Source = "https://github.com/impire-io/poseres"
|
|
19
|
+
"Bug Tracker" = "https://github.com/impire-io/poseres/issues"
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
dev = ["pytest>=8.0", "ruff>=0.6"]
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
pra-validate = "pra.harness.cli:main"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
29
|
+
|
|
30
|
+
[tool.ruff]
|
|
31
|
+
line-length = 100
|
|
32
|
+
target-version = "py313"
|
|
33
|
+
extend-exclude = ["design", "archive", ".venv"]
|
|
34
|
+
|
|
35
|
+
[tool.ruff.lint]
|
|
36
|
+
select = ["E", "F", "I", "W", "UP", "B"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
addopts = "-q"
|
|
41
|
+
filterwarnings = ["error"]
|
poseres-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: poseres
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pose Resolution Architecture — validation harness and batched in-memory core
|
|
5
|
+
Author: Daan Gerits
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/impire-io/poseres
|
|
8
|
+
Project-URL: Source, https://github.com/impire-io/poseres
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/impire-io/poseres/issues
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Requires-Python: >=3.13
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy>=2.4
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
17
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# PRA — Pose Resolution Architecture
|
|
21
|
+
|
|
22
|
+
An in-memory, batched, deterministic core (PRA-01) and the validation harness
|
|
23
|
+
(PRA-02) that runs the acceptance suite **T1–T6** plus the investigatory
|
|
24
|
+
**T-SCALE**, emitting an honest, reproducible PASS/FAIL verdict per test.
|
|
25
|
+
|
|
26
|
+
See `specs/001-validation-harness/` for the spec, plan, and contracts, and
|
|
27
|
+
`design/` for the architecture documents. The behavioral oracle is
|
|
28
|
+
`design/validate/pra_sim_v4.py`.
|
|
29
|
+
|
|
30
|
+
## Quickstart
|
|
31
|
+
|
|
32
|
+
**Fastest — install from PyPI with [`uv`](https://docs.astral.sh/uv/):**
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uvx --from poseres pra-validate suite
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
No Python version juggling, no venv to manage. `uv` fetches Python 3.13 automatically if you don't have it.
|
|
39
|
+
|
|
40
|
+
**From source:**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/impire-io/poseres.git
|
|
44
|
+
cd pra
|
|
45
|
+
python3.13 -m venv .venv
|
|
46
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
47
|
+
pip install -e ".[dev]" # numpy + pytest + ruff
|
|
48
|
+
|
|
49
|
+
pra-validate suite # 8 seeds, true_dim=3, checkpoints 18/30/50
|
|
50
|
+
pra-validate suite --json out/report.json
|
|
51
|
+
pra-validate determinism --seed 1 # byte-identical re-run check
|
|
52
|
+
pra-validate scale --true-dims 20,35,50
|
|
53
|
+
pra-validate scan --true-dim 20 --hidden-sizes 12,32,64 # diagnostic dimension scan
|
|
54
|
+
pra-validate agency # curious vs random (T7) + value-signal telemetry
|
|
55
|
+
|
|
56
|
+
ruff format --check . && ruff check . && pytest -q
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Independent seeds run in parallel worker processes by default (`--workers`,
|
|
60
|
+
0 = one per seed up to the CPU count) — parallelism never changes results
|
|
61
|
+
(byte-identical to sequential; each run keeps its own seeded, single-threaded
|
|
62
|
+
pipeline). The full default suite runs in ~20s on a 14-core machine.
|
|
63
|
+
|
|
64
|
+
`suite` emits, for each of **T1–T6**, the measured aggregate (mean ± std), the
|
|
65
|
+
exact pass criterion, and PASS/FAIL. **T4** is shown as the full per-seed `best_dim`
|
|
66
|
+
spread at every horizon checkpoint and PASSes only if the within-one-of-true
|
|
67
|
+
majority holds at *every* checkpoint — it can never pass on a lucky single horizon.
|
|
68
|
+
**T5** PASSes only when the population genuinely self-limits (no seed strictly
|
|
69
|
+
growing over its final third), not merely because it hit a cap. A single-seed run is
|
|
70
|
+
labelled **FOR DEBUGGING ONLY**. Exit code is 0 even when a test FAILs (a FAIL is
|
|
71
|
+
data, not a CLI error) unless `--strict` is passed.
|
|
72
|
+
|
|
73
|
+
## Governing principle — honest summary
|
|
74
|
+
|
|
75
|
+
Where a tidy report and a faithful one conflict, the faithful one wins (FR-008): a
|
|
76
|
+
failing test is shown as FAIL *with the numbers that explain it*; a test needing a
|
|
77
|
+
spread is never reported by its mean alone; a seed that errors is surfaced and the
|
|
78
|
+
aggregate flagged incomplete, never silently dropped; too few samples reads
|
|
79
|
+
"not available", never a fabricated number. Two runs of a seed produce
|
|
80
|
+
byte-identical telemetry (single seeded RNG, fixed draw order, single-threaded BLAS).
|
|
81
|
+
|
|
82
|
+
## Layout
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
src/pra/
|
|
86
|
+
config.py # every PRA-01 §8 parameter + validation
|
|
87
|
+
world/event_source.py# EventSource seam + SensorimotorWorld (nonlinear, hidden latent)
|
|
88
|
+
core/ # contracts, bus, scorer, policies, the batched FrameGroup kernel, engine
|
|
89
|
+
motivation/ # Drive seam: curiosity (learning progress + novelty), weighted drive set
|
|
90
|
+
action/ # Policy seam: pinned random baseline + one-step curiosity lookahead
|
|
91
|
+
persistence/ # snapshot/restore: versioned blob + atomic SnapshotStore (opt-in)
|
|
92
|
+
anatomy/ # body: sensors/actuators, fixed-order composition, runtime tools
|
|
93
|
+
telemetry/recorder.py# deterministic per-seed summary
|
|
94
|
+
harness/ # acceptance (T1-T7/T-SCALE), runner, report, cli, scale, scan, agency
|
|
95
|
+
tests/ # unit (incl. batched-vs-reference proof) / contract (5 seams) / integration
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Behavioral oracle
|
|
99
|
+
|
|
100
|
+
`design/validate/pra_sim_v4.py` is the validated reference run. The batched core
|
|
101
|
+
reproduces its T1–T6 trajectory at the default config (the per-frame-vs-batched
|
|
102
|
+
equivalence is enforced by `tests/unit/test_batched_equivalence.py`) at roughly 40×
|
|
103
|
+
the speed. The full default suite (8 seeds × predictive + ablation × 50 cycles)
|
|
104
|
+
completes in well under a minute.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/poseres.egg-info/PKG-INFO
|
|
5
|
+
src/poseres.egg-info/SOURCES.txt
|
|
6
|
+
src/poseres.egg-info/dependency_links.txt
|
|
7
|
+
src/poseres.egg-info/entry_points.txt
|
|
8
|
+
src/poseres.egg-info/requires.txt
|
|
9
|
+
src/poseres.egg-info/top_level.txt
|
|
10
|
+
src/pra/__init__.py
|
|
11
|
+
src/pra/config.py
|
|
12
|
+
src/pra/action/__init__.py
|
|
13
|
+
src/pra/action/policy.py
|
|
14
|
+
src/pra/anatomy/__init__.py
|
|
15
|
+
src/pra/anatomy/body.py
|
|
16
|
+
src/pra/core/__init__.py
|
|
17
|
+
src/pra/core/bus.py
|
|
18
|
+
src/pra/core/contracts.py
|
|
19
|
+
src/pra/core/engine.py
|
|
20
|
+
src/pra/core/frame.py
|
|
21
|
+
src/pra/core/policies.py
|
|
22
|
+
src/pra/core/scorer.py
|
|
23
|
+
src/pra/harness/__init__.py
|
|
24
|
+
src/pra/harness/acceptance.py
|
|
25
|
+
src/pra/harness/agency.py
|
|
26
|
+
src/pra/harness/cli.py
|
|
27
|
+
src/pra/harness/report.py
|
|
28
|
+
src/pra/harness/runner.py
|
|
29
|
+
src/pra/harness/scale.py
|
|
30
|
+
src/pra/harness/scan.py
|
|
31
|
+
src/pra/motivation/__init__.py
|
|
32
|
+
src/pra/motivation/context.py
|
|
33
|
+
src/pra/motivation/drive.py
|
|
34
|
+
src/pra/persistence/__init__.py
|
|
35
|
+
src/pra/persistence/snapshot.py
|
|
36
|
+
src/pra/persistence/store.py
|
|
37
|
+
src/pra/telemetry/__init__.py
|
|
38
|
+
src/pra/telemetry/recorder.py
|
|
39
|
+
src/pra/world/__init__.py
|
|
40
|
+
src/pra/world/event_source.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pra
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Pose Resolution Architecture (PRA).
|
|
2
|
+
|
|
3
|
+
A single in-memory, batched, deterministic core (PRA-01) plus the validation
|
|
4
|
+
harness (PRA-02) that runs the acceptance suite T1-T6 and the investigatory
|
|
5
|
+
T-SCALE.
|
|
6
|
+
|
|
7
|
+
Determinism (FR-010, SC-007, PRA-01 §7.1) requires a fixed float-accumulation
|
|
8
|
+
order. We pin every BLAS backend to a single thread *before* numpy is imported
|
|
9
|
+
anywhere in the process, so reductions are byte-stable across runs on one
|
|
10
|
+
machine. This module is imported before any ``pra`` submodule pulls in numpy.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os as _os
|
|
14
|
+
|
|
15
|
+
# Pin BLAS threading before numpy is first imported (PRA-01 §7.1, research R3).
|
|
16
|
+
for _var in (
|
|
17
|
+
"OMP_NUM_THREADS",
|
|
18
|
+
"OPENBLAS_NUM_THREADS",
|
|
19
|
+
"MKL_NUM_THREADS",
|
|
20
|
+
"VECLIB_MAXIMUM_THREADS",
|
|
21
|
+
"NUMEXPR_NUM_THREADS",
|
|
22
|
+
):
|
|
23
|
+
_os.environ.setdefault(_var, "1")
|
|
24
|
+
|
|
25
|
+
__all__ = ["__version__"]
|
|
26
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Action component (design Doc 05 §4): policy seam -> action selection."""
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Policies: action selection (Doc 05 §4).
|
|
2
|
+
|
|
3
|
+
The Policy seam replaces the engine's inline random action draw. The default
|
|
4
|
+
``RandomPolicy`` reproduces that draw EXACTLY — one ``rng.integers(n_actions)``
|
|
5
|
+
per step, nothing else — so every existing mode (the validated T1-T6 suite,
|
|
6
|
+
determinism, scale, scan) consumes an identical RNG stream and stays
|
|
7
|
+
byte-identical to the validated build (FR-008, research R1).
|
|
8
|
+
|
|
9
|
+
``CuriosityLookaheadPolicy`` is the shipped directed default (Doc 05 §4.2/§4.3):
|
|
10
|
+
ε-gate first; uniformly random when exploring, when no best frame exists, or
|
|
11
|
+
when the best frame is younger than the maturity bar; otherwise a one-step
|
|
12
|
+
lookahead — predict each candidate action's outcome with the best frame's
|
|
13
|
+
transition model, decode it, value it via the drive set — choosing the argmax
|
|
14
|
+
with ties broken by the lowest action index (no further draws). Policies are
|
|
15
|
+
stateless across steps; all randomness comes from the run's single seeded
|
|
16
|
+
generator in this fixed order (FR-007).
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from collections.abc import Callable
|
|
22
|
+
from dataclasses import dataclass
|
|
23
|
+
from typing import Protocol, runtime_checkable
|
|
24
|
+
|
|
25
|
+
import numpy as np
|
|
26
|
+
|
|
27
|
+
from pra.config import Config
|
|
28
|
+
|
|
29
|
+
__all__ = ["PolicyContext", "Policy", "RandomPolicy", "CuriosityLookaheadPolicy", "PolicyParams"]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
class PolicyContext:
|
|
34
|
+
"""The read-only view a policy selects from (data-model §3)."""
|
|
35
|
+
|
|
36
|
+
observation: np.ndarray
|
|
37
|
+
n_actions: int
|
|
38
|
+
best_frame_age: int | None # None when no frame exists
|
|
39
|
+
predict_decoded: Callable[[int], np.ndarray | None] # best-frame one-step, decoded
|
|
40
|
+
drive_value_of: Callable[[np.ndarray], float] # drive set valued at a hypothetical obs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@runtime_checkable
|
|
44
|
+
class Policy(Protocol):
|
|
45
|
+
def select_action(self, context: PolicyContext, rng: np.random.Generator) -> int: ...
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class RandomPolicy:
|
|
49
|
+
"""The pinned validation baseline: exactly the validated engine's inline draw."""
|
|
50
|
+
|
|
51
|
+
def select_action(self, context: PolicyContext, rng: np.random.Generator) -> int:
|
|
52
|
+
return int(rng.integers(context.n_actions))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class PolicyParams:
|
|
57
|
+
exploration_epsilon: float
|
|
58
|
+
lookahead_min_age_cycles: int
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_config(cls, config: Config) -> PolicyParams:
|
|
62
|
+
return cls(
|
|
63
|
+
exploration_epsilon=config.exploration_epsilon,
|
|
64
|
+
lookahead_min_age_cycles=config.lookahead_min_age_cycles,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class CuriosityLookaheadPolicy:
|
|
69
|
+
"""One-step curiosity lookahead with ε-exploration and a cold-start gate."""
|
|
70
|
+
|
|
71
|
+
def __init__(self, params: PolicyParams):
|
|
72
|
+
self.params = params
|
|
73
|
+
self.last_was_directed = False # telemetry only; overwritten every step
|
|
74
|
+
|
|
75
|
+
def select_action(self, context: PolicyContext, rng: np.random.Generator) -> int:
|
|
76
|
+
# Fixed draw order (research R3): one uniform for the ε-gate, then one
|
|
77
|
+
# integer draw only on the random path. Exploit draws nothing further.
|
|
78
|
+
explore = rng.random() < self.params.exploration_epsilon
|
|
79
|
+
immature = (
|
|
80
|
+
context.best_frame_age is None
|
|
81
|
+
or context.best_frame_age < self.params.lookahead_min_age_cycles
|
|
82
|
+
)
|
|
83
|
+
if explore or immature:
|
|
84
|
+
self.last_was_directed = False
|
|
85
|
+
return int(rng.integers(context.n_actions))
|
|
86
|
+
|
|
87
|
+
best_action = 0
|
|
88
|
+
best_value = -np.inf
|
|
89
|
+
for action in range(context.n_actions): # ascending: lowest index wins ties
|
|
90
|
+
predicted = context.predict_decoded(action)
|
|
91
|
+
if predicted is None:
|
|
92
|
+
continue
|
|
93
|
+
value = context.drive_value_of(predicted)
|
|
94
|
+
if value > best_value:
|
|
95
|
+
best_value = value
|
|
96
|
+
best_action = action
|
|
97
|
+
self.last_was_directed = True
|
|
98
|
+
return best_action
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Anatomy component (design Doc 02): sensors, actuators, the composed body, tools."""
|