Fix #303: align edof_per_coef length with coefficients#507
Closed
MahmoudAdelbghany wants to merge 4 commits intodswah:mainfrom
Closed
Fix #303: align edof_per_coef length with coefficients#507MahmoudAdelbghany wants to merge 4 commits intodswah:mainfrom
MahmoudAdelbghany wants to merge 4 commits intodswah:mainfrom
Conversation
- reproduce with high-spline rank-deficient fit\n- root cause: edof diagonal can be shorter than coef_\n- fix: pad missing entries with trailing zeros before storing statistics\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
No code changes.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix intermittent Windows CI failures caused by Tk initialization errors in test_gen_imgs by selecting a non-interactive backend before importing gen_imgs.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follow CI ruff hook ordering for stdlib and third-party imports.\n\nCo-authored-by: Copilot <223556219+Copilot@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.
Summary
Fixes the
edof_per_coeflength mismatch described in #303 sosummary()can report term-level effective DoF consistently.Story / Investigation
len(gam.statistics_["edof_per_coef"]) < len(gam.coef_).PoissonGAM(n_splines=25)on a small synthetic dataset.edof_per_coefandcoef_.gam.summary()and observe missing term-level EDoF output._estimate_model_statisticsstoresnp.diagonal(U1.dot(U1.T))directly, which can be shorter than coefficient count when rank drops.len(coef_)before assigningstatistics_["edof_per_coef"].Tests
test_more_splines_than_samplesto assert aligned lengths.pytest -q pygam/tests/test_GAM_methods.py -k more_splines_than_samples