Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 18975c3

Browse filesBrowse files
seanbenhurglemaitre
authored andcommitted
DOC Added utils.gen_batches in documentation (scikit-learn#19688)
1 parent 0c7c615 commit 18975c3
Copy full SHA for 18975c3

File tree

3 files changed

+13
-0
lines changed
Filter options

3 files changed

+13
-0
lines changed

‎doc/developers/utilities.rst

Copy file name to clipboardExpand all lines: doc/developers/utilities.rst
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ Helper Functions
196196
to ``n``. Used in :func:`~sklearn.decomposition.dict_learning` and
197197
:func:`~sklearn.cluster.k_means`.
198198

199+
- :class:`gen_batches`: generator to create slices containing batch size elements
200+
from 0 to ``n``
201+
199202
- :func:`safe_mask`: Helper function to convert a mask to the format expected
200203
by the numpy array or scipy sparse matrix on which to use it (sparse
201204
matrices support integer indices only while numpy arrays support both

‎doc/modules/classes.rst

Copy file name to clipboardExpand all lines: doc/modules/classes.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,7 @@ Plotting
15931593
utils.extmath.fast_logdet
15941594
utils.extmath.density
15951595
utils.extmath.weighted_mode
1596+
utils.gen_batches
15961597
utils.gen_even_slices
15971598
utils.graph.single_source_shortest_path_length
15981599
utils.graph_shortest_path.graph_shortest_path

‎sklearn/utils/__init__.py

Copy file name to clipboardExpand all lines: sklearn/utils/__init__.py
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,10 @@ def gen_batches(n, batch_size, *, min_batch_size=0):
691691
------
692692
slice of batch_size elements
693693
694+
See Also
695+
--------
696+
gen_even_slices: Generator to create n_packs slices going up to n.
697+
694698
Examples
695699
--------
696700
>>> from sklearn.utils import gen_batches
@@ -740,6 +744,11 @@ def gen_even_slices(n, n_packs, *, n_samples=None):
740744
------
741745
slice
742746
747+
See Also
748+
--------
749+
gen_batches: Generator to create slices containing batch_size elements
750+
from 0 to n.
751+
743752
Examples
744753
--------
745754
>>> from sklearn.utils import gen_even_slices

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.