Skip to content

docs: correct docstrings across batch, multivariate, regression, univariate - #514

Open
kgdunn wants to merge 1 commit into
mainfrom
claude/determined-fermat-o6vluf
Open

kgdunn wants to merge 1 commit into
mainfrom
claude/determined-fermat-o6vluf

Conversation

@kgdunn

@kgdunn kgdunn commented Aug 21, 2026

Copy link
Copy Markdown
Owner

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_wide unconditionally returned {} while its docstring simply said "Convert aligned melted data to wide format." Docstring now says "Not yet implemented (returns an empty dict); see also dict_to_wide."
  • src/process_improve/batch/data_input.py (lines 194, 200): wide_to_melted and wide_to_dict said "Not yet implemented" while silently returning empty structures. wide_to_dict also took no arguments, so any 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 were updated to pytest.raises(NotImplementedError).
  • src/process_improve/multivariate/_pca.py (lines 220-233, 271-280): PCA docstring now documents n_components : int or None, and __init__ defaults n_components to None; this matches _parameter_constraints ([int, None]) and fit(), which already clamped None to min(n_samples, n_features).
  • src/process_improve/multivariate/_pca.py (line 302): the fitting_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): the conf_intervals entry in robust_regression's Returns block described it as K rows x 2 columns, but the function only supports single-predictor regression. Rewritten as 1 x 2 (lower, upper) confidence interval for the single slope coefficient. The K-row wording on the sibling multiple_linear_regression (line 325) was left untouched.
  • src/process_improve/univariate/metrics.py (lines 63-70): t_value_cdf doctests used np.inf without importing numpy into the doctest namespace. Replaced with float("inf") / float("-inf"), which needs no import and matches the surrounding style. t_value didn't actually use np.inf in its doctest code (only in the :math: prose), so it was left alone.

Version bumped 1.66.2 -> 1.66.3 (PATCH, docs). CITATION.cff synced to the new version and today's date (2026-08-21). New Documentation bullet added under ## [Unreleased] in CHANGELOG.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-existing ImportError for the optional scikit-fda/pyDOE3 extras and are unrelated to this change.

Checklist

  • Version bumped in pyproject.toml (PATCH, docs-only)
  • Tests added or updated where relevant (two stub tests re-pointed at pytest.raises(NotImplementedError))
  • ruff check . passes
  • CHANGELOG.md updated
  • CITATION.cff version and date synced

Generated by Claude Code

…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

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants