Repository navigation
Findings: methodology review (rebased into research/) + measured bias-gate finding - #32
Merged
Merged
Conversation
Statistics/ML audit of the modeling core, with the top findings quantified on the fasteners and used-cars case studies: - Retransformation bias: log-target back-transform via plain exp() runs 7.9% low in mean terms on used-cars; Duan smearing fixes the mean (residual -$1,419 -> +$2) but is median-hostile on heavy tails (fasteners S=4.05). - Residual-bias gate tests price-space residuals: both case-study models flip from 'unreliable' to trustworthy/usable when tested in log space; gate also lacks a materiality threshold. - Pre-split outlier/selection leakage: negligible per se, but drop-policy cleaned holdouts flatter reported R^2 by +0.06-0.10 at full scale. Adds analysis/methodology_review.md (ranked findings + proposed follow-up PR order) and case-studies/benchmark_methodology_gaps.py (reproducible measurements, results checked in).
…-gate finding Rebases the July methodology audit onto current main and moves all three files into research/ (the folder analysis/ was renamed to in 429ee7c), so the finding sits with its script and results per the research/README hygiene rule. Adds a Status header to methodology_review.md marking what has moved since July: finding 1 superseded by log_retransformation_bias.md, finding 2 sharpened here, the Tier-2/3 out-of-distribution bullet shipped as #36; findings 3 and 4 still open and unaddressed in core (verified: no GroupShuffleSplit/GroupKFold in src/; find_leaky_features is wired into the MCP server but not the CLI). Adds bias_gate_materiality.{md,py,json}. assess_model() calls a model biased when a t-test on price-space residuals reaches p <= 0.05 — a question whose answer depends on sample size, not on whether the bias is big enough to matter. Measured by holding the model and its bias fixed and varying only the holdout size (200 draws per size, heavy-equipment model, R2 0.737): median mean-residual stays flat at -5.4% to -6.1% while the share of draws flagged 'unreliable' goes 10% (n=50) -> 47% (n=250) -> 96% (n=1,000) -> 100% (n=16,000). Same model, same bias, opposite verdict. The gate fails in both directions, because `unbiased = p > 0.05` reads failure to reject as proof of no bias. Large holdout: any offset eventually flags, so the user with the best price history is likeliest to be told the model can't be trusted — both flagship case studies currently earn 'unreliable' despite median residuals of +1.7%. Small holdout: the battery-management-IC model carries a -7.5% mean residual on 30 parts and is stamped 'trustworthy'. That over-trust direction is the one the July review explicitly ruled out. Also corrects the July review on one point: it reported both case-study models flipping to trustworthy/usable when tested in log space. An independent refit reproduces this for heavy equipment (p 9.8e-55 -> 0.585) but not for used cars (4.4e-71 -> 0.034, still failing), whose -27.2% mean residual is larger than a retransformation artifact. Testing in log space is therefore not on its own a sufficient fix. No core changes.
ahmed-khalil-hafsi
force-pushed
the
findings/methodology-review
branch
from
September 10, 2026 09:35
1f763be to
ff4c3ce
Compare
ahmed-khalil-hafsi
added a commit
that referenced
this pull request
Sep 15, 2026
…-gate finding (#32) * Findings: methodology review with measured Tier-1 gaps (no core changes) Statistics/ML audit of the modeling core, with the top findings quantified on the fasteners and used-cars case studies: - Retransformation bias: log-target back-transform via plain exp() runs 7.9% low in mean terms on used-cars; Duan smearing fixes the mean (residual -$1,419 -> +$2) but is median-hostile on heavy tails (fasteners S=4.05). - Residual-bias gate tests price-space residuals: both case-study models flip from 'unreliable' to trustworthy/usable when tested in log space; gate also lacks a materiality threshold. - Pre-split outlier/selection leakage: negligible per se, but drop-policy cleaned holdouts flatter reported R^2 by +0.06-0.10 at full scale. Adds analysis/methodology_review.md (ranked findings + proposed follow-up PR order) and case-studies/benchmark_methodology_gaps.py (reproducible measurements, results checked in). * Findings: rebase methodology review into research/, add measured bias-gate finding Rebases the July methodology audit onto current main and moves all three files into research/ (the folder analysis/ was renamed to in 429ee7c), so the finding sits with its script and results per the research/README hygiene rule. Adds a Status header to methodology_review.md marking what has moved since July: finding 1 superseded by log_retransformation_bias.md, finding 2 sharpened here, the Tier-2/3 out-of-distribution bullet shipped as #36; findings 3 and 4 still open and unaddressed in core (verified: no GroupShuffleSplit/GroupKFold in src/; find_leaky_features is wired into the MCP server but not the CLI). Adds bias_gate_materiality.{md,py,json}. assess_model() calls a model biased when a t-test on price-space residuals reaches p <= 0.05 — a question whose answer depends on sample size, not on whether the bias is big enough to matter. Measured by holding the model and its bias fixed and varying only the holdout size (200 draws per size, heavy-equipment model, R2 0.737): median mean-residual stays flat at -5.4% to -6.1% while the share of draws flagged 'unreliable' goes 10% (n=50) -> 47% (n=250) -> 96% (n=1,000) -> 100% (n=16,000). Same model, same bias, opposite verdict. The gate fails in both directions, because `unbiased = p > 0.05` reads failure to reject as proof of no bias. Large holdout: any offset eventually flags, so the user with the best price history is likeliest to be told the model can't be trusted — both flagship case studies currently earn 'unreliable' despite median residuals of +1.7%. Small holdout: the battery-management-IC model carries a -7.5% mean residual on 30 parts and is stamped 'trustworthy'. That over-trust direction is the one the July review explicitly ruled out. Also corrects the July review on one point: it reported both case-study models flipping to trustworthy/usable when tested in log space. An independent refit reproduces this for heavy equipment (p 9.8e-55 -> 0.585) but not for used cars (4.4e-71 -> 0.034, still failing), whose -27.2% mean residual is larger than a retransformation artifact. Testing in log space is therefore not on its own a sufficient fix. No core changes. --------- Co-authored-by: Ahmed K. Hafsi <25119333+ahmed-hafsi@users.noreply.github.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.
Rebases the July methodology audit onto current
main, moves it intoresearch/, and adds a measured follow-on finding. No core changes.Why this sat for two months
It bundles four findings, so merging it meant accepting a four-item agenda. Two have since been re-derived independently, which is evidence the bundle was too big to act on — not that the findings were wrong. This PR splits the bundle apart instead.
What changed in this update
mainand moved all three files intoresearch/— the PR still targetedanalysis/, which429ee7crenamed away. Merging as-is would have resurrected the dead folder.methodology_review.mdso nothing dangles:log_retransformation_bias.md--feature-outliers drop; defaultwarnunaffected. Sub-item "wirefind_leaky_featuresinto the CLI" partly landed (it's in the MCP server, not the CLI).GroupShuffleSplit/GroupKFoldinsrc/out_of_domain_flag.md, merged in #36bias_gate_materiality.{md,py,json}— finding v0.4: SHAP per-prediction explanations #2, measured.The new finding: the gate measures n, not bias
assess_model()calls a model biased whenresidual_bias_p <= 0.05— a t-test on price-space residuals (quality.py:333). A p-value answers "could this be noise?", which depends on sample size. It does not answer "is this big enough to matter?", which is what the verdict claims to report.Measured by holding the model and its bias fixed and varying only the holdout size — 200 random draws per row, heavy-equipment model, R² 0.737:
unreliableThe bias column is flat. The verdict column goes 10% → 100%.
It fails in both directions, because
unbiased = p > 0.05reads failure to reject as proof of no bias:unreliable. Both flagship case studies earn it today despite median residuals of +1.7% — the user with the best price history is likeliest to be told their model can't be trusted.trustworthy. This over-trust direction is the one the July review explicitly ruled out ("failure direction is under-trust").unreliableunreliabletrustworthyOne correction to the July review
It reported both case-study models flipping to
trustworthy/usablewhen tested in log space. An independent refit reproduces this for heavy equipment (p 9.8e-55 → 0.585) but not for used cars (4.4e-71 → 0.034, still failing) — its −27.2% mean residual is larger than a retransformation artifact can explain. So testing in log space is not on its own a sufficient fix, and a verdict hinging on 0.034 vs 0.585 is itself the argument for a materiality floor.Reproduce