Skip to content

feat: add action_rate check and Cohort statistics docs - #40

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
Sagar-024:feature/action-rate-check
Aug 20, 2026
Merged

feat: add action_rate check and Cohort statistics docs#40
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
Sagar-024:feature/action-rate-check

Conversation

@Sagar-024

Copy link
Copy Markdown
Contributor

Summary

Adds the action_rate built-in check and a "Cohort statistics" section in docs/CATALOG.md, per the design agreed in Discussion #24. That discussion is the design doc.

The check records the raw per-episode message rate of the given action topics as action_rate_hz. Evidence only, no verdict: n timestamps define n - 1 intervals, so the rate is intervals divided by the span across the selected topics.

The docs section records the DuckDB window-function pattern for cohort math (z-score via (value - AVG(value) OVER ()) / STDDEV(value) OVER (), plus PERCENT_RANK()), with the corpus-relative caveat: compute the window over the same filtered cohort you intend to cut.

Validation

  • uv run ruff check --fix && uv run ruff format
  • uv run ty check (only pre-existing Windows platform diagnostics in runtime/_bundle.py, storage.py, and test_runtime_bundle.py; none in the new code)
  • uv run pytest -q tests/test_checks.py (11 passed)

Checklist

  • Outcome-focused test added: synthetic episode rate matches the spec's 100 Hz joint stream
  • Docs updated for the new behavior
  • ruff, ty, and pytest run
  • git status contains no recordings, generated artifacts, credentials, or runtime bundles

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Sagar-024! This delivers the design from #24 exactly as agreed: raw action_rate_hz evidence in the check, cohort math as a documented DuckDB window pattern, and the corpus-relative caveat stated. The note that STDDEV over a single-row cohort returns NULL 'which is the correct answer' is a genuinely useful addition we did not ask for. Validated locally: quality gate, full suite (296 tests), and the docs link check all pass.

One semantic worth recording for posterity, not blocking: with multiple topics the check records the summed rate over the union span rather than a per-topic mean. That is the right aggregate for 'how fast is this rig acting overall', and the docstring plus PR description state the formula, so future readers will not be surprised. Merging.

@kstonekuan
kstonekuan merged commit 06d66b0 into Hebbian-Robotics:main Aug 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants