Make ltriangle density floor relative to scale - #184
Merged
joethorley merged 2 commits intoJul 14, 2026
Conversation
Follow-up to #169. The soft density floor in the log-triangular likelihood was an absolute 1e-8, which is not scale-consistent across data magnitudes. It is now 1e-8 * scalelog (a fraction of the peak density argument) so the soft barrier behaves the same regardless of the magnitude of the data. Fits where the support covers the data are unchanged (the floor never binds), so no existing snapshots change. Adds a scale-invariance test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #169 (targets the
add-triangle-distributionbranch).Addresses the statistical review item on the soft density floor in the log-triangular likelihood.
The uncensored branch of
ll_ltriangle.hppfloors the density argument to keep the likelihood finite when a candidate support fails to cover a data point. That floor was an absolute1e-8, which is not consistent across data magnitudes (the density argument has the units ofscalelog, so an absolute floor bites differently depending on the scale of the data). It is now relative:1e-8 * scalelog, i.e. a fixed fraction of the peak density argument.scalelogunchanged, shiftslocationlogbylog(1000), and scales the HC5 by 1000. This property is what a scale-relative floor protects and an absolute floor can break at extreme magnitudes.Per your steer on the review, this is the "relative to scale" option. Note this keeps the soft-barrier design (a non-covering fit still receives a finite likelihood / AIC weight); flagging such fits as invalid would be a larger, separate change if wanted.
🤖 Generated with Claude Code