Make two interleaving half circles.
A simple toy dataset to visualize clustering and classification algorithms. Read more in the User Guide.
If int, the total number of points generated. If two-element tuple, number of points in each of two moons.
Changed in version 0.23: Added two-element tuple.
Whether to shuffle the samples.
Standard deviation of Gaussian noise added to the data.
Determines random number generation for dataset shuffling and noise. Pass an int for reproducible output across multiple function calls. See Glossary.
The generated samples.
The integer labels (0 or 1) for class membership of each sample.
>>> from sklearn.datasets import make_moons >>> X, y = make_moons(n_samples=200, noise=0.2, random_state=42) >>> X.shape (200, 2) >>> y.shape (200,)
© 2007–2025 The scikit-learn developers
Licensed under the 3-clause BSD License.
https://scikit-learn.org/1.6/modules/generated/sklearn.datasets.make_moons.html