Skip to content

Add asymmetric_translog: translog with sign-split own squares around an estimated knot - #102

Open
hmgaudecker wants to merge 7 commits into
missing-observed-factorsfrom
asymmetric-translog
Open

hmgaudecker wants to merge 7 commits into
missing-observed-factorsfrom
asymmetric-translog

Conversation

@hmgaudecker

@hmgaudecker hmgaudecker commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Stacked on #103 (missing-observed-factors). Replaces #101: stable_translog is dropped; this PR also carries #101's CI-sharding commit.

Implements docs/superpowers/specs/2026-10-16-asymmetric-translog-design.md.

What

New built-in transition function

f(x) = c + Σ β_j x_j + Σ γ⁺_j max(x_j − κ_j, 0)² + Σ γ⁻_j min(x_j − κ_j, 0)² + Σ_{a<b} δ_ab x_a x_b

  • One curvature coefficient per side of a per-factor knot κ_j; C¹ in x and κ (no where, no clipping).
  • Knots are parameters, estimated by default; fix them through the usual machinery (e.g. to profile over a grid).
  • Nests translog: γ⁺ = γ⁻ gives a translog with shifted linear/constant terms; with κ = 0 it is exactly translog.
  • Parameter layout: linear, f ** 2 (above), f ** 2 (below), f knot, interactions, constant. Identity constraints: own linear 1, everything else (knots included) 0.

Motivation (spec §1): in the health-cognition application the measures revert strongly at one end of the range and are near-linear at the other. A single square coefficient then forces an own slope above one at the near-linear end; a symmetric clip of the states cannot separate the two ends either.

Registration

_AF_COMPATIBLE_TRANSITIONS, _LEAKY_BUILTIN_PRODUCTION (AF), builtin_names (AMN resolver), the reference-guide lists.

Tests

  • tests/test_asymmetric_translog.py: translog nesting (κ = 0 and κ ≠ 0, 1e-12), one-sided derivatives, C¹ at the knot in x and κ, names/identity constraints, JIT/vmap/50-step scan vs eager, and a fixed-point witness for the application pattern.
  • tests/test_asymmetric_translog_dispatch.py: public model, AMN resolver, AF allow-lists/validation, with a value that distinguishes the two sides of the knot.
  • tests/test_asymmetric_translog_estimation.py: a registered same-law reference reproduces CHS loglikeobs (1e-10) and the gradient (rtol 1e-8); equal curvature with zero knots reproduces translog; unequal curvature and swapped sides change the result; endogenous carry-forward substeps accept the function.

Full suite (pytest tests -m 'not long_running' -n 2 on 831db22): 857 passed.

https://claude.ai/code/session_017psXwkMuDeVmTu5WgoM26k

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.51%. Comparing base (9cd73db) to head (1be29c7).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           stable-translog     #102      +/-   ##
===================================================
+ Coverage            95.42%   95.51%   +0.08%     
===================================================
  Files                  148      151       +3     
  Lines                15178    15459     +281     
===================================================
+ Hits                 14484    14765     +281     
  Misses                 694      694              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

hmgaudecker and others added 7 commits October 18, 2026 08:00
…runners

The three estimation tests in tests/test_chs_estimate.py take about four
minutes each and dominated the twenty-minute suite. Each now runs in its own
ubuntu job; the rest shard on every OS deselects them. Coverage uploads
from the four Linux jobs are merged by codecov.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017psXwkMuDeVmTu5WgoM26k
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017psXwkMuDeVmTu5WgoM26k
f = c + Σβx + Σγ⁺max(x−κ,0)² + Σγ⁻min(x−κ,0)² + Σδ x_a x_b, C¹ in x and κ.
Nests translog (γ⁺ = γ⁻, κ = 0). Kernel tests per spec section 5 items 1-7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017psXwkMuDeVmTu5WgoM26k
Same-law registered reference reproduces contributions and gradient; equal
curvature with zero knots reproduces translog; endogenous carry-forward substeps
accept the function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017psXwkMuDeVmTu5WgoM26k
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017psXwkMuDeVmTu5WgoM26k
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y3CuwvNUhYTSpriKYSwqmq
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@hmgaudecker
hmgaudecker changed the base branch from stable-translog to missing-observed-factors October 18, 2026 06:21
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.

1 participant