Add a fit_at override to gg_calc_fit, and rename h -> g - #51
Merged
Conversation
gg_calc_fit takes an optional third argument, fit_at = (m_max, nd_max), which overrides params.m_max / params.nd_max and fits at that one point. This is how a particular fit is picked out of a scan already run: read the (m_max, nd_max) row wanted off the scan table gg_show_fit_results prints, then refit there without editing the params. Everything else in params -- nd_max_for_m, exclude_functions, the pruning limits, the weighting -- still applies, candidates are still clamped to what the coefficient table holds, and the result carries an empty scan field, since one point is not a scan. Refitting at a scan point reproduces it exactly: same unknowns, same coefficients, same per-plane residuals. Also rename the bending strength from h to g throughout the table generator and the leftover h-named locals, matching g_ref everywhere else, and trim the GGFitInputParams docstring down to the parameter reference it is meant to be -- the fit_criterion score formulas and the pruning discussion now live only in the gg_calc_fit docstring, which is where the docstring test looks for them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
📖 Documentation preview for this PR: https://bmad-sim.github.io/GeneralizedGradients.jl/previews/PR51/ Rebuilt on every push; removed automatically when the PR closes. |
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.
fit_at
gg_calc_fittakes an optional third argument:When given,
fit_atoverridesparams.m_maxandparams.nd_maxand the scan is done at that one point:This is how a particular fit is picked out of a scan already run: read the
(m_max, nd_max)row wanted off the scan tablegg_show_fit_resultsprints, then refit there without editing the params.The override enters where the candidate list is resolved, so everything downstream is untouched —
nd_max_for_m,exclude_functions, the pruning limits and the weighting all still apply, candidates are still clamped to what the coefficient table holds, negatives still error. Both values beingInt, the returnedGGFithas an emptyscanfield: one point is not a scan.h -> g
The bending strength is
g_refeverywhere in the package, but the table generator and a few locals still called ith. Renamed throughout (MAX_H->MAX_G,mul1phx->mul1pgx,coeff_poly_h->coeff_poly_g, ...). Comments and thegg_coef_table.jlheader follow. No coefficient values change.Docstrings
GGFitInputParamsis trimmed back to the parameter reference it is meant to be: thefit_criterionscore formulas and the pruning discussion now live only in thegg_calc_fitdocstring. Thepublic docstrings are attachedtest followed them there — it still requiresfit_criterion,:aicand:bicto be named in the parameter reference, and now requires the fullln(RSS/N)formula ingg_calc_fit.Tests
New
gg_calc_fit fit_at overridetestset: every row of a 6-point scan refits to the same(m_max, nd_max)and coefficient count; the winning row matches coefficient-for-coefficient and residual-for-residual; the override beats a scalarparams.m_max/nd_maxwhileexclude_functionsstill applies; clamping and the negative-value errors behave as they do throughparams.Full suite: 1128 passed, 0 failed.
🤖 Generated with Claude Code