docs: fix a batch of docstring/code inconsistencies (no behaviour change) - #472
Open
kgdunn wants to merge 11 commits into
Open
docs: fix a batch of docstring/code inconsistencies (no behaviour change)#472kgdunn wants to merge 11 commits into
kgdunn wants to merge 11 commits into
Conversation
The parameter description said 'shows the SPE after this number of model components' but t2_plot plots Hotelling's T^2. Reword to match the actual statistic shown.
Both docstrings claimed the defaults (np.mean / np.std) skip missing data, but those functions propagate NaN. Reword to describe the actual behaviour and point callers at np.nanmean / np.nanstd when NaN-skipping is desired.
The docstring said the three mode flags are mutually exclusive, but the __init__ guard only raises when all three are set at once. Document the actual behaviour (all-three-set trigger; resample() prefers jackknife over bootstrap over fractional) so users are not misled by the guarantee. The guard itself is left unchanged; the underlying bug is flagged in the PR body for the maintainer.
Settings has no override() method. Point users at the per-knob property setters (each property has a paired setter) and describe reload() / as_dict() in terms of what they actually do.
The module docstring is explicit that importing themes does NOT set the Plotly default template, but the DEFAULT_THEME attribute docstring contradicted that. Reword to match: DEFAULT_THEME is the theme this library's own plots request explicitly, and set_theme() is the way to change the process-wide default.
The function validates the batch id column and then unconditionally returns an empty dict; the real pivot is commented out beneath. Add a warning admonition so callers do not silently receive an empty result believing they got a reshaped view. Flagged for maintainer follow-up in the PR body.
f_crossing's docstring promised per-phase evaluation via phase_col but the implementation hard-wires phase_col=None when calling _prepare_data, so crossings are computed across the whole batch instead. Add a note to make the current behaviour explicit; the underlying bug is flagged in the PR body for the maintainer.
The docstring implied any numeric alpha sets the axial distance directly, but under cube='full' the code discards numeric values and forces the pyDOE3 'orthogonal' alpha instead. Only cube='fractional' actually honours a numeric alpha. Document the split so callers do not silently get an 'orthogonal' design when they passed a specific number. The behavioural gap is flagged in the PR body for the maintainer.
…note Two docstring drifts in PCA: - select_n_components was missing the return_consensus parameter and the four extra Bunch keys it enables (minka_n_components, parallel_analysis_n_components, consensus, consensus_counts). Document both. - parallel_analysis said scale=True 'matches minka_mle', but minka_mle only mean-centres while parallel_analysis(scale=True) additionally unit-variance-scales via MCUVScaler. Describe the actual behaviour.
The example built new_data as a plain dict, but diagnose() raises TypeError unless the argument is a DataFrameDict. Update the example so the code actually runs.
Docs-only PATCH bump for the docstring-drift fixes across the codebase. CITATION.cff and CHANGELOG.md updated in the same commit per repo policy.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
multivariate,batch,experiments,visualization, andconfigmodules. No runtime behaviour is changed.1.59.1with matchingCITATION.cffandCHANGELOG.mdupdates.Fixes
src/process_improve/multivariate/plots.py:575t2_plot(with_aparam)src/process_improve/multivariate/_preprocessing.py:161centerfunc=np.meanpropagates NaN. Reworded to describe the actual NaN-propagating behaviour and to point atnp.nanmeanwhen NaN-skipping is desired.src/process_improve/multivariate/_preprocessing.py:187scalecenter:np.stdpropagates NaN. Reworded and pointed atnp.nanstd.src/process_improve/multivariate/_resampling.py:49Resampler.__init__use_jackknife,bootstrap_rounds,fraction_excludedare mutually exclusive, but the guard only fires when all three are set. Reworded to describe the actual guard and to note theresample()precedence (jackknife > bootstrap > fractional). See "Bugs flagged for maintainer" below.src/process_improve/config.py:138Settingsclass docstringoverride()to set a single knob"; no such method exists. Now points at the per-knob property setters and describesreload()/as_dict().src/process_improve/visualization/themes.py:68DEFAULT_THEMEattributeDEFAULT_THEMEis the theme this library's own plots request explicitly; useset_theme()to opt a whole session in.src/process_improve/batch/data_input.py:173melted_to_wide{}. Added a.. warning::admonition marking it as a stub. See "Bugs flagged for maintainer".src/process_improve/batch/features.py:625f_crossingphase_col, but the implementation hard-wiresphase_col=Nonewhen calling_prepare_data. Added a note thatphase_colis currently ignored. See "Bugs flagged for maintainer".src/process_improve/experiments/designs_response_surface.py:30dispatch_ccdalphasets the axial distance directly, but undercube="full"numeric values are coerced to the pyDOE3"orthogonal"alpha. Split the wording: numeric alpha honoured undercube="fractional", silently discarded undercube="full". See "Bugs flagged for maintainer".src/process_improve/multivariate/_pca.py:1010PCA.select_n_componentsreturn_consensus: bool = Falsewas missing from Parameters; the extra Bunch keys (minka_n_components,parallel_analysis_n_components,consensus,consensus_counts) were missing from Returns. Both added.src/process_improve/multivariate/_pca.py:892PCA.parallel_analysisscale=True"matchesminka_mle", butminka_mleonly mean-centres whileparallel_analysis(scale=True)also unit-variance-scales viaMCUVScaler. Corrected.src/process_improve/multivariate/_tpls.py:557TPLS.diagnosenew_dataas a plaindict, but the method raisesTypeErrorunless the argument is aDataFrameDict. Wrapped the example.Bugs flagged for maintainer
These are real code bugs rather than docstring drift. This PR leaves the code alone and only makes the docstrings describe the current (buggy) behaviour honestly. Filing them for follow-up:
Resampler.__init__mutual-exclusion guard is too weak (src/process_improve/multivariate/_resampling.py:84). The guard raises only whenuse_jackknifeandbootstrap_rounds > 0andfraction_excluded > 0.0are all set simultaneously. Pairwise conflicts (e.g.use_jackknife=True, bootstrap_rounds=100) slip through and are silently resolved byresample()'s ordering (jackknife > bootstrap > fractional). Suggested fix: count how many of the three modes are active and raise when the count is greater than one.melted_to_wideis a silent stub (src/process_improve/batch/data_input.py:173). Callers get back an emptydictwith no warning. The intended pivot implementation is present but commented out. Suggested fix: either finish the implementation (there is a sketch just below the return) or raiseNotImplementedErrorso callers cannot use it accidentally.f_crossingignoresphase_col(src/process_improve/batch/features.py:663-669). The function acceptsphase_colas a parameter but hard-wiresphase_col=Noneon the call to_prepare_data, so the per-phase behaviour promised by the docstring never actually runs. Suggested fix: forwardphase_col=phase_coland add tests that cover phased data.dispatch_ccdsilently discards numericalphaundercube="full"(src/process_improve/experiments/designs_response_surface.py:101-104). Theisinstance(alpha, (int, float))branch setsalpha_str = "orthogonal"andface = "circumscribed", effectively throwing the numeric value away. Callers who pass e.g.alpha=1.68undercube="full"get an orthogonal design and no warning. Suggested fix: either honour the numeric value (pyDOE3'sccdesignaccepts numeric alpha under an appropriatealpha=setting) or raise aValueErrortelling the caller that numeric alpha is only supported forcube="fractional".Test plan
uv run ruff check src/process_improvepasses.uv run ruff format --checkon the touched files: no new formatting drift introduced by this PR (the pre-existing repo-wide format drift is unrelated and outside the scope of a docstring-only patch).pyproject.toml(version bump),CITATION.cff(version + date), andCHANGELOG.md(entry).uv.lockwas not committed (per repo policy for Claude Code sessions).Checklist
pyproject.toml(PATCH: 1.59.0 → 1.59.1, docs-only).CITATION.cffversion +date-releasedsynced to 1.59.1 / 2026-07-24.CHANGELOG.mdupdated with a 1.59.1 section and its compare-link footer.ruff check .passes on the touched files.Generated with Claude Code
https://claude.ai/code/session_019ocQ71UFry6rkJnBNLeQKg
Generated by Claude Code