Skip to content

Commit adb1ae7

Browse files
DOC Add vector quantization example to KBinsDiscretizer docs (#31613)
Co-authored-by: Stefanie Senger <91849487+StefanieSenger@users.noreply.github.com>
1 parent aa58933 commit adb1ae7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sklearn/preprocessing/_discretization.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ class KBinsDiscretizer(TransformerMixin, BaseEstimator):
179179
[-0.5, 2.5, -2.5, -0.5],
180180
[ 0.5, 3.5, -1.5, 0.5],
181181
[ 0.5, 3.5, -1.5, 1.5]])
182+
183+
While this preprocessing step can be an optimization, it is important
184+
to note the array returned by ``inverse_transform`` will have an internal type
185+
of ``np.float64`` or ``np.float32``, denoted by the ``dtype`` input argument.
186+
This can drastically increase the memory usage of the array. See the
187+
:ref:`sphx_glr_auto_examples_cluster_plot_face_compress.py`
188+
where `KBinsDescretizer` is used to cluster the image into bins and increases
189+
the size of the image by 8x.
182190
"""
183191

184192
_parameter_constraints: dict = {

0 commit comments

Comments
 (0)