Skip to content

HistogramRepresentation: give bin_edges a parameter entry - #11

Merged
luizfernandolj merged 1 commit into
masterfrom
docstring-bin-edges
Nov 9, 2026
Merged

luizfernandolj merged 1 commit into
masterfrom
docstring-bin-edges

Conversation

@luizfernandolj

Copy link
Copy Markdown
Collaborator

What is wrong

bin_edges has no name line in HistogramRepresentation's Parameters section. Its description sits at the end of the nested Example block belonging to partition_blocks:

        ``partition_blocks=True``, ``block_slices_`` will be something like
        ...
        4-element histogram for that feature.
        The method for determining bin edges. Options are:
        - "fixed": Use fixed bin edges based on the ``range`` parameter.
        - "quantile": Use quantile-based bin edges.
    laplace_smoothing : bool, default=False

So numpydoc reads those three lines as part of partition_blocks, and bin_edges is undocumented.

The description is also wrong about the options. It offers "fixed" and "quantile". The code accepts "fixed" and "auto", and raises on anything else:

raise ValueError("bin_edges must be either 'fixed' or 'auto'.")

The documented option does not exist, and the real one is not mentioned. That matters now that HDx depends on "auto".

What this does

  • Gives bin_edges its own entry, in signature order, between partition_blocks and laplace_smoothing.
  • Lists the options the code actually accepts, and says what "auto" does: per-feature edges fitted in fit, with the outer bins left unbounded so values beyond the fitted range land in the end bins instead of being dropped.
  • Puts a blank line before the mode option list, which an RST bullet list needs.

Checks

Every __init__ parameter is now documented, in signature order, verified against inspect.signature:

assinatura   : ['bins', 'range', 'mode', 'features', 'partition_blocks', 'bin_edges', 'laplace_smoothing']
documentados : ['bins', 'range', 'mode', 'features', 'partition_blocks', 'bin_edges', 'laplace_smoothing']

Docstring only, no behaviour change. 277 tests pass and the representations module's 16 doctests pass.

🤖 Generated with Claude Code

bin_edges had no name line in the Parameters section at all. Its description
sat at the end of the nested "Example" block of partition_blocks, so
numpydoc read it as part of that parameter and bin_edges came out
undocumented.

The description was also wrong about the options. It offered "fixed" and
"quantile"; the code accepts "fixed" and "auto" and raises on anything else,
so the documented option did not exist and the real one was not mentioned.
That matters now that HDx depends on "auto".

Every __init__ parameter is now documented, in signature order. Also puts a
blank line before the mode option list, which an RST bullet list needs.

Docstring only; no behaviour changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@luizfernandolj
luizfernandolj merged commit bb09166 into master Nov 9, 2026
14 checks passed
luizfernandolj added a commit that referenced this pull request Nov 9, 2026
The Unreleased section still said "Nothing yet. Add user-visible changes
here as they land", while six PRs had landed: #7, #10, #6, #8, #9 and #11.

Two of them change output and say so in bold, because someone holding
results from v0.5.1 is affected: HDx estimates differ now that raw features
are binned on their own scale, and the one-vs-rest path returns a uniform
vector instead of all-zeros where every class used to clip to zero. The MLPE
change is cost only and the entry says the estimate is unchanged.

The Tests entry says ten of the thirteen new tests fail on v0.5.1, not all
thirteen: the three parametrized cv cases already passed and guard against
regression rather than capturing the bug.

Markdown only; no code and no behaviour change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant