Conversation
…ariate Six docstring/small-code corrections found during a follow-up audit after PR #495: - batch/data_input.melted_to_wide: docstring now says the function is not yet implemented and returns an empty dict, pointing at the companion dict_to_wide. - batch/data_input.wide_to_melted, wide_to_dict: docstrings said 'Not yet implemented' while the bodies silently returned an empty DataFrame / did nothing (and wide_to_dict took no arguments, so a caller passing a DataFrame got a TypeError). Both now accept the expected input and raise NotImplementedError so the behaviour matches the docs. The two stub tests are updated accordingly. - multivariate/_pca.PCA: class docstring documents n_components as int or None (matching _parameter_constraints and fit(), which already handled None by clamping to min(n_samples, n_features)); __init__ signature defaults n_components to None to match. Also fixes the inline comment on fitting_info_ that swapped the mapping from algorithm to output shape (arrays are produced by SVD/NIPALS, scalar totals by TSR). - regression/_robust_regression.robust_regression: conf_intervals is described as a single-slope 1 x 2 interval, not a K-row block; the function only supports single-predictor regression. - univariate/metrics.t_value_cdf: doctests use float('-inf') / float('inf') instead of np.inf, which was previously referenced without an in-doctest numpy import. Docs-only PATCH bump; sync CITATION.cff and add a CHANGELOG entry under [Unreleased]. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eNvkh6WTyBeTt4fTVxmUr
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
Follow-up docstring audit after #495. Six small drifts between what the docstring says and what the code does, plus one tiny code fix to make two stubs behave the way their docstrings claim.
src/process_improve/batch/data_input.py(line 174):melted_to_wideunconditionally returned{}while its docstring simply said "Convert aligned melted data to wide format." Docstring now says "Not yet implemented (returns an empty dict); see alsodict_to_wide."src/process_improve/batch/data_input.py(lines 194, 200):wide_to_meltedandwide_to_dictsaid "Not yet implemented" while silently returning empty structures.wide_to_dictalso took no arguments, so any caller passing a DataFrame got aTypeError. Both now accept the expected input andraise NotImplementedErrorso the behaviour matches the docs. The two stub tests were updated topytest.raises(NotImplementedError).src/process_improve/multivariate/_pca.py(lines 220-233, 271-280):PCAdocstring now documentsn_components : int or None, and__init__defaultsn_componentstoNone; this matches_parameter_constraints([int, None]) andfit(), which already clampedNonetomin(n_samples, n_features).src/process_improve/multivariate/_pca.py(line 302): thefitting_info_inline comment had algorithm-to-shape backwards. Corrected to "per-component arrays (SVD/NIPALS) or scalar totals (TSR)."src/process_improve/regression/_robust_regression.py(line 135): theconf_intervalsentry inrobust_regression's Returns block described it asK rows x 2 columns, but the function only supports single-predictor regression. Rewritten as1 x 2 (lower, upper) confidence interval for the single slope coefficient. The K-row wording on the siblingmultiple_linear_regression(line 325) was left untouched.src/process_improve/univariate/metrics.py(lines 63-70):t_value_cdfdoctests usednp.infwithout importing numpy into the doctest namespace. Replaced withfloat("inf")/float("-inf"), which needs no import and matches the surrounding style.t_valuedidn't actually usenp.infin its doctest code (only in the:math:prose), so it was left alone.Version bumped 1.66.2 -> 1.66.3 (PATCH, docs).
CITATION.cffsynced to the new version and today's date (2026-08-21). New Documentation bullet added under## [Unreleased]inCHANGELOG.md.Test plan
uv run ruff check src/process_improve/... tests/batch/test_data_input.py- passes.uv run ruff format --check src/process_improve/... tests/batch/test_data_input.py- 5 files already formatted.uv run pytest tests/batch/test_data_input.py --no-cov- 10 passed.uv run pytest tests/test_multivariate.py tests/test_regression.py tests/test_univariate.py tests/batch/ --no-cov- 302 passed, 2 skipped. The 4 errors seen are pre-existingImportErrorfor the optionalscikit-fda/pyDOE3 extras and are unrelated to this change.Checklist
pyproject.toml(PATCH, docs-only)pytest.raises(NotImplementedError))ruff check .passesCHANGELOG.mdupdatedCITATION.cffversion and date syncedGenerated by Claude Code