Skip to content

Refuse LogKDE(displace_t=True) for models whose RTs start below t - #375

Merged
AlexanderFengler merged 2 commits into
mainfrom
fix/kde-displace-t-guard
Oct 7, 2026
Merged

AlexanderFengler merged 2 commits into
mainfrom
fix/kde-displace-t-guard

Conversation

@AlexanderFengler

@AlexanderFengler AlexanderFengler commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Refuse displace_t=True for models whose response times start below t

LogKDE(displace_t=True) shifts every RT by t and floors any label that lands at or below zero. For the models listed in KDE_NO_DISPLACE_T, and for those whose config declares ndt_edge_shift (#370), that puts the cutoff inside the response-time support: a uniform st kernel starts at t - st, and the Normal, truncated-Normal and Rayleigh kernels have no edge at t at all. TrainingDataGenerator already warns and overrides displace_t to False for these models, so the data pipeline was never affected, but a direct LogKDE caller got flat labels in the band below t with no warning.

LogKDE now resolves the model from metadata["model"] (a _deadline suffix stripped, as lan_mlp does) and raises a ValueError naming the model and pointing at displace_t=False when its config declares ndt_edge_shift or its config name is in KDE_NO_DISPLACE_T. An unregistered model name is refused when the metadata carries a non-zero st. Every other model keeps the shift by t, byte-for-byte.

Credit

This replaces #359 by @EItanm1999, who found the problem and measured its effect on labels. #359 recovered the boundary from the simulator metadata (t - st for the uniform kernels, t + t_dist.keywords["loc"] otherwise). That is right for the uniform kernels but misreads ddm_truncnormt, where loc is the kernel's centre and the support edge is 0, so its labels collapsed. Since the generator never displaces these models, direct callers get an explicit error instead of a different shift.

Checks

  • tests/test_kde_class.py: 42 passed. New tests cover every KDE_NO_DISPLACE_T entry plus full_ddm2 (raises with the model named; displace_t=False still works), the two guard clauses independently, ddm/ddm_sdv/angle labels pinned to the shift-by-t formula, an unregistered model judged by its st, and _deadline names. The 11 must-raise cases fail on origin/main without the source change; the 7 behaviour-pinning cases pass on both.
  • LogKDE(displace_t=True) labels, samples and inputs for ddm, ddm_sdv, angle evaluated on a fixed grid before and after the change: byte-identical.
  • Full suite: 1322 passed, 134 skipped. ruff check and ruff format --check clean. git merge-tree against origin/main clean.

Closes #359.

🤖 Generated with Claude Code

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Response-time shifting now rejects models that do not support it, with guidance to disable shifting. Supported models retain their existing behavior.

AlexanderFengler and others added 2 commits October 7, 2026 22:34
LogKDE(displace_t=True) shifts every RT by t and floors the labels of
anything that lands at or below zero. For the models in KDE_NO_DISPLACE_T
and those declaring ndt_edge_shift that puts the cutoff inside the
response-time support: a uniform st kernel starts at t - st, and the
Normal, truncated-Normal and Rayleigh kernels have no edge at t at all.
TrainingDataGenerator already overrides displace_t to False for them, so
the pipeline was never affected; a direct LogKDE caller got flat labels
in the band below t without a word.

LogKDE now resolves the model from metadata["model"] (a _deadline suffix
stripped, as lan_mlp does) and raises a ValueError naming the model when
its config declares ndt_edge_shift or its name is in KDE_NO_DISPLACE_T.
An unregistered name is refused when the metadata carries a non-zero st.
Every other model keeps the shift by t unchanged.

This replaces #359 by EItanm1999, which recovered the boundary from the
simulator metadata instead: t - st for the uniform kernels, which was
right, and t + t_dist.keywords["loc"] otherwise, which for ddm_truncnormt
is the kernel's centre rather than its edge at 0 and collapsed the
labels. Since the generator never displaces these models, the honest
behaviour for direct callers is an error pointing at displace_t=False.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Every KDE_NO_DISPLACE_T model (plus full_ddm2, whose config name differs
from its key) is refused at displace_t=True with the model named and
still builds at displace_t=False. ddm, ddm_sdv and angle keep the plain
shift by the metadata t, pinned against the label formula. An
unregistered model is judged by its st, and a _deadline name is looked
up by its base model.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 78627e9b-a8b4-4be7-beb2-0bca31304d5f
📥 Commits

Reviewing files that changed from the base of the PR and between d6be76b and 0009d20.

📒 Files selected for processing (2)
  • ssms/support_utils/kde_class.py
  • tests/test_kde_class.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

LogKDE now checks model metadata before shifting response times when displace_t=True. Unsupported models raise ValueError. Tests cover registered and unregistered models, timing variability, and deadline-suffixed names.

Changes

Displacement validation

Layer / File(s) Summary
Determine displacement support
ssms/support_utils/kde_class.py
A new check removes a trailing _deadline for model lookup. It rejects registered models with ndt_edge_shift or a name in KDE_NO_DISPLACE_T. For unregistered models, it rejects non-zero st.
Enforce support checks in LogKDE
ssms/support_utils/kde_class.py, tests/test_kde_class.py
The constructor runs the support check when displace_t=True and retains the existing multiple-t validation. Documentation and tests cover unsupported cases, supported models, and deadline-suffixed names.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 0009d

LogKDE now raises a clear ValueError when displacement is requested for models whose response times can start below t. Other models keep the existing shift. No actionable merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning Issue #359 requires LogKDE to displace by the true admissibility boundary for variable non-decision time, including t - st for ddm_st and ddm_sz_st, and numeric st metadata for full_ddm an… Implement the #359 boundary calculation in LogKDE for the affected model metadata shapes. Use t - st for the uniform non-decision-time support and handle the numeric st metadata used by full_ddm and full_ddm2. Keep the t boundar…
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: LogKDE(displace_t=True) now refuses models whose response times start below t.
Out of Scope Changes check ✅ Passed The guard in ssms/support_utils/kde_class.py, the constructor documentation, and the tests in tests/test_kde_class.py all concern LogKDE(displace_t=True) behavior, model metadata, or regression …
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files.
Full details: Linked Issues check

Explanation

Issue #359 requires LogKDE to displace by the true admissibility boundary for variable non-decision time, including t - st for ddm_st and ddm_sz_st, and numeric st metadata for full_ddm and full_ddm2. The changed LogKDE code instead raises ValueError for affected registered models and does not calculate or use the adjusted boundary. The tests verify refusal, not the required corrected displacement. Fixed-t models retain the existing behavior.

Resolution

Implement the #359 boundary calculation in LogKDE for the affected model metadata shapes. Use t - st for the uniform non-decision-time support and handle the numeric st metadata used by full_ddm and full_ddm2. Keep the t boundary for fixed-t models and add tests for labels and sampling at the corrected boundary.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 94.47% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ssms/support_utils/kde_class.py 91.46% <100.00%> (+2.34%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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