Explorer uncertainty and strict lint - #28
Merged
Merged
Conversation
Both the strength-curve shaded band and the cost readout now display
posterior uncertainty at ±2σ (~95% credible interval). Previously the
band was ±2σ but the cost readout was ±1σ — the same ± symbol meant
two different things in the same view, an avoidable cognitive hazard.
Changes:
* docs/ui.mjs::updateUI cost readout: format as
'± {(2 * costStd).toFixed(1)} (2σ)' so the explicit '(2σ)' suffix
tells users which confidence band they're seeing.
* docs/ui.mjs::drawStrengthCurve: add an on-canvas legend
'shaded: ±2σ' in the top-right corner of the strength-curve plot
so users don't need to open the About modal to know what the
shaded band represents.
* The existing About-modal text (docs/index.html:141) already
documents ±2σ for shaded bands — kept as-is, now consistent with
both the canvas legend and the readout.
SebastianAment
force-pushed
the
explorer-uncertainty-and-strict-lint
branch
2 times, most recently
from
June 9, 2026 19:57
154c3ed to
3a7e82f
Compare
…ev-onboarding
Adds the full E-class style codes plus the pyflakes bug-detectors to
the CI strict-select list so they fail the build instead of merely
warning. Local pre-commit config now mirrors CI, so 'green locally'
implies 'green CI'. Plus README onboarding for new contributors.
Strict-select gates now include:
* E9 / F63 / F7 / F82 syntax errors, undefined names
* F401 / F811 / F841 unused imports / redefinitions / unused locals
* E202 whitespace before '}'
* E226 missing whitespace around arithmetic operator
* E251 unexpected spaces around keyword/parameter equals
* E402 module-level import not at top of file
* E501 line too long (88-char limit, matches BoTorch)
* E741 ambiguous variable name ('I'/'l'/'O')
Files modified to conform:
* boxcrete/slump_model.py drop unused 'import torch'
* docs/generate_mix_analyses.py drop unused 'cost'/'str_1' locals;
wrap ~20 long f-strings
* test/test_partial_fixed_noise_likelihood.py drop unused 'n_total'
* boxcrete/features.py move 'from boxcrete.utils import
DEFAULT_X_COLUMNS' to top of module
* experiments/regenerate_strength_json.py relocate '# noqa: E402'
to opening line of multi-line import
* boxcrete/plotting.py:191 rename 'I' -> 'eye_n' (E741)
* test/test_models.py:412 rename 'I' -> 'eye_n' (E741)
* boxcrete/utils.py:275-276,467 f-string '{x = }' -> '{x=}' (E202/E251)
* experiments/check_artifacts_drift.py '*100' -> '* 100' (E226)
* test/test_lengthscale_identifiability.py '*100' -> '* 100' (E226)
* boxcrete/concrete_model.py wrap 5 long docstring/error lines
* boxcrete/kernels.py wrap 196-char inline comment
* boxcrete/likelihoods.py wrap 4 long pragma-comment lines
* boxcrete/utils.py wrap 5 long docstring/error lines
* boxcrete/slump_model.py wrap 1 long module-docstring line
* docs/generate_mix_analyses.py wrap 1 long obs-str line
* experiments/regenerate_strength_json.py wrap 2 long print lines
* test/test_models.py:220 tighten long docstring
* test/test_strength_curve_monotonicity.py wrap 3 long error-msg lines
* test/test_utils.py:679 tighten long docstring
Bonus fix in .flake8: explicit 'exclude' list was silently overriding
flake8's defaults, so .git, __pycache__, .hg, etc. were being linted.
Sapling stores backup copies of working-tree files under
.git/sl/origbackups/ — without the explicit re-add of the default
excludes, flake8 was reporting violations from old deleted research
code. Defaults restored explicitly.
Developer ergonomics:
* .pre-commit-config.yaml synced to the CI strict-select so the
local pre-commit hook fails on the same codes CI does (no more
'green locally, red on CI' surprises).
* README adds a 'Development' section explaining
'pip install -e ".[dev]" && pre-commit install' onboarding, the
role of black (auto-fix) vs flake8 (gate), and the 88-char line
convention (matches BoTorch/GPyTorch).
SebastianAment
force-pushed
the
explorer-uncertainty-and-strict-lint
branch
from
June 9, 2026 20:15
3a7e82f to
e8403c8
Compare
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.
Explorer uncertainty consistency + strict-lint hardening
Two cleanups following the V2 strength GP open-source PR.
1. Consistent ±2σ uncertainty in the explorer (
f974a55)The strength-curve plot has always shaded
mean ± 2σ, but the cost readout displayed± 1σ— same±symbol, two different conventions in the same view.docs/ui.mjs::updateUI— cost readout now reads± {2σ value} (2σ).docs/ui.mjs::drawStrengthCurve— adds a small on-canvasshaded: ±2σlegend in the plot's top-right corner.±2σfor the band — kept as-is, now consistent end-to-end.2. Strict-lint hardening + dev-onboarding (
3a7e82f)CI's flake8 strict-select now covers the full set of bug-detector and key style codes (matching BoTorch/GPyTorch's 88-char convention):
E9, F63, F7, F82F401, F811, F841E202}E226E251E402E501E741I/l/O)Files modified to conform
boxcrete/slump_model.py— drop unusedimport torch.docs/generate_mix_analyses.py— drop unusedcost/str_1locals; wrap ~20 long f-strings.test/test_partial_fixed_noise_likelihood.py— drop unusedn_total.boxcrete/features.py— movefrom boxcrete.utils import DEFAULT_X_COLUMNSto top of module (E402); wrap 3 long lambda-builder lines.experiments/regenerate_strength_json.py— relocate# noqa: E402to opening line of multi-line import; wrap 2 long print lines.boxcrete/plotting.py:191+test/test_models.py:412— renameI = torch.eye(...)→eye_n(E741: linear-algebraIclashes with1/l).boxcrete/utils.py— f-string{x = }→{x=}(E202/E251); wrap 5 long docstring/error lines.experiments/check_artifacts_drift.py—*100→* 100(E226).test/test_lengthscale_identifiability.py—*100→* 100(E226).boxcrete/concrete_model.py— wrap 5 long docstring/error lines.boxcrete/kernels.py— wrap a 196-char inlinepragma: no covercomment.boxcrete/likelihoods.py— wrap 4 longpragma: no coverlines.boxcrete/slump_model.py— wrap 1 long module-docstring line.test/test_strength_curve_monotonicity.py— wrap 3 long error-message lines.test/test_models.py:220,test/test_utils.py:679— tighten 2 long docstrings.Bonus fix in
.flake8The explicit
excludelist (build, dist, .eggs) silently overrode flake8's defaults, so.git,__pycache__,.hg, etc. were being linted. Sapling stores backup copies of working-tree files under.git/sl/origbackups/— without explicit re-add of the default excludes, flake8 reported 26 phantom violations from old deleted research code. Defaults restored explicitly.Developer ergonomics
.pre-commit-config.yamlsynced to match CI's strict-select. "Green locally" now implies "green CI" — no more surprises after pushing.README.mdnew## Developmentsection explaining one-time setup:pip install -e ".[dev]" pre-commit install