Skip to content

docs: correct docstring/implementation drift across multivariate, regression, experiments, and monitoring - #495

Merged
kgdunn merged 15 commits into
mainfrom
claude/determined-fermat-4p687n
Aug 14, 2026
Merged

docs: correct docstring/implementation drift across multivariate, regression, experiments, and monitoring#495
kgdunn merged 15 commits into
mainfrom
claude/determined-fermat-4p687n

Conversation

@kgdunn

@kgdunn kgdunn commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

Docstring-only corrections across several modules where the NumPy-style docstring drifted from the actual runtime behavior. No runtime behavior is changed; only the documented behavior is aligned with the code.

Grouped by module:

Experiments

  • experiments/designs_response_surface.py::dispatch_ccd - note that a numeric alpha is only honored for the fractional-cube path; cube="full" silently coerces it to "orthogonal".
  • experiments/designs.py::generate_design - same caveat propagated at the wrapper level.
  • experiments/analysis.py::analyze_experiment - add the missing model_summary keys (formula, n_obs, n_terms, model_rank, rank_deficient, df_model, df_residual, mse_residual) to the Returns section.

Multivariate

  • multivariate/_pca.py::PCA.select_n_components - document return_consensus in Parameters and the extra Returns keys (minka_n_components, parallel_analysis_n_components, consensus, consensus_counts).
  • multivariate/_pls.py::PLS.select_n_components - complete the truncated selection_mode Returns sentence.
  • multivariate/_mbpls.py::MBPLS - flesh out the Attributes section with the fitted attributes actually set in fit().
  • multivariate/_mbpca.py::MBPCA - same, replacing the "as MBPLS" shorthand with the concrete list.
  • multivariate/_tpls.py::TPLS - list undocumented fitted attributes and add a note that TPLS attributes deliberately do not follow the sklearn trailing-underscore convention.
  • multivariate/_opls.py::OPLS.spe_ - clarify that per-column values are broadcasts of the final-component SPE, not a per-component progression.
  • multivariate/_limits.py::spe_calculation - note the SEC-21/[SEC-21] NaN-poisoning in single-block PCA / PLS / TPLS #270 fallback when variance/center is at or below epsqrt.

Regression

  • regression/_robust_regression.py::robust_regression - add t_value to the always-present keys and note the initialization values on the degenerate early-return path.
  • regression/_robust_regression.py::multiple_linear_regression - align the Returns list with the actual OLS.to_dict() output (degenerate-path shapes, plus R2_regression_based, R2_residual_based, k, conf_interval_intercept).

Univariate

  • univariate/metrics.py::t_value - replace undefined v in examples with a concrete value and correct the p in {0, 1} behavior description.
  • univariate/metrics.py::t_value_cdf - same fix.
  • univariate/metrics.py::ttest_paired - clarify that the value under the "Standard deviation" key is actually the standard error of the mean difference (key name kept as-is to avoid a behavior change).

Bivariate

  • bivariate/_elbow_peak.py::find_elbow_point - document the secondary NaN return path.

Monitoring

  • monitoring/control_charts.py::ControlChart.__init__ - align the documented variant values with the branches that actually exist.

Test plan

  • Docstring-only edits; no runtime behavior changed.
  • ruff check . passes.
  • ruff format --check . passes.

Checklist

  • Version bumped in pyproject.toml (PATCH for docs)
  • Tests added or updated where relevant (N/A - docs-only)
  • ruff check . passes
  • CHANGELOG.md updated

🤖 Generated with Claude Code


Generated by Claude Code

claude added 8 commits August 14, 2026 07:53
Add caveat noting that a numeric alpha is only honored for the
fractional-cube CCD path; cube='full' silently coerces it to 'orthogonal'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
Propagate the same numeric-alpha caveat: a numeric alpha is only honored
for cube='fractional'; cube='full' silently coerces it to 'orthogonal'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
PCA.select_n_components: document return_consensus in Parameters and
add the four extra Returns keys it exposes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
PLS.select_n_components: complete the truncated selection_mode Returns
sentence (mode is None when selection_distribution is None).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
robust_regression: add t_value to always-present keys and describe the
degenerate early-return dict contents.

multiple_linear_regression: align Returns with OLS.to_dict() output.
Add R2_regression_based, R2_residual_based, k, conf_interval_intercept;
document the degenerate-path shapes for coefficients and conf_intervals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
MBPLS: expand the Attributes section to list every fitted attribute
actually set in fit() (n_samples_, n_targets_, n_features_in_,
feature_names_in_, preproc_, y_preproc_, super_hotellings_t2_,
super_vip_, block_spe_, block_hotellings_t2_, block_vip_, and the
r2_x_/r2_y_ family).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
MBPCA: expand the Attributes section to list every fitted attribute
individually with its shape/type, replacing the '(as MBPLS)' shorthand.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
TPLS: expand the Attributes section from two fields to the full set of
attributes set in fit() (score/loading families, spe/spe_limit nested
dicts, mask arrays, name maps, etc.) and add a note that TPLS does not
follow the sklearn trailing-underscore convention for its fitted
attributes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

claude added 7 commits August 14, 2026 07:59
OPLS.spe_: clarify that the returned DataFrame's per-column values are
broadcasts of the final-component SPE, not a per-component progression
like the PCA/PLS spe_.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
spe_calculation: document the SEC-21/#270 fallback: when variance or
centre of the squared SPE is at or below epsqrt, the Jackson-Mudholkar
chi-square approximation degenerates and the limit falls back to
sqrt(center_spe).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
t_value / t_value_cdf: replace undefined 'v' in the doctest examples
with 'v=10' and correct the -inf / +inf renderings (scipy returns
-inf / +inf at p in {0, 1}, not NaN, and Python prints them lowercase).

ttest_paired already documents that its 'Standard deviation' key holds
the standard error of the mean difference, so no change is needed
there.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
find_elbow_point: add an explicit Returns section that covers both
the -1 (all-missing) and NaN (no consensus intersection) return paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
analyze_experiment: enumerate every key that the always-present
model_summary dict actually carries (formula, n_obs, n_terms,
model_rank, rank_deficient, df_model, df_residual, mse_residual),
in addition to the R^2 and adequate-precision entries that were
already documented.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
ControlChart.__init__: mark 'cusum' as an unimplemented future variant;
only 'hw' and 'xbar.no.subgroup' are dispatched by calculate_limits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
Docs-only PATCH bump. Sync CITATION.cff to the same version and today's
date; add a Documentation entry under [Unreleased] in CHANGELOG.md
summarising the 17 docstring corrections in this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0132CNPVroNNG679mikPzqwc
@kgdunn
kgdunn merged commit 4b84d75 into main Aug 14, 2026
14 checks passed
@kgdunn
kgdunn deleted the claude/determined-fermat-4p687n branch August 14, 2026 09:46
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