From 4b240a36df2e085a3c0b3614e99b680a405b8d2f Mon Sep 17 00:00:00 2001 From: luizfernandolj Date: Mon, 9 Nov 2026 11:28:03 -0300 Subject: [PATCH] HistogramRepresentation: give bin_edges a parameter entry 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 --- mlquantify/representations/_histogram.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mlquantify/representations/_histogram.py b/mlquantify/representations/_histogram.py index 8b9188d0..80a31116 100644 --- a/mlquantify/representations/_histogram.py +++ b/mlquantify/representations/_histogram.py @@ -16,6 +16,7 @@ class HistogramRepresentation(BaseRepresentation): The lower and upper bounds for the histogram range. mode : str, default="histogram" The mode of the histogram. Options are: + - "histogram": Compute the histogram counts. - "onehot": Compute a one-hot encoding of the histogram. In this mode, the output is a binary vector indicating which bin each value falls into, averaged over all samples. features : array-like of shape (n_features,), default=None @@ -39,9 +40,15 @@ class HistogramRepresentation(BaseRepresentation): ``(slice(0, 3), slice(3, 7))``. To extract the second feature's block from a representation ``rep`` you can use ``rep[block_slices_[1]]`` which returns the 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. + bin_edges : {'fixed', 'auto'}, default='fixed' + Where the bin edges are placed. + + - ``'fixed'``: equal-width edges spanning ``range``. + - ``'auto'``: per-feature edges fitted to the data in ``fit``, with + the outer bins left unbounded so values beyond the fitted range + fall in the end bins instead of being dropped. This is what + histograms of raw features need, since features are not on the + ``[0, 1]`` scale that ``range`` defaults to. laplace_smoothing : bool, default=False Whether to apply Laplace smoothing to the histogram counts.