This is documentation for an old release of Scikit-learn (version 0.22). Try the latest stable release (version 1.6) or development (unstable) versions.

sklearn.datasets.make_moons

sklearn.datasets.make_moons(n_samples=100, shuffle=True, noise=None, random_state=None)[source]

Make two interleaving half circles

A simple toy dataset to visualize clustering and classification algorithms. Read more in the User Guide.

Parameters
n_samplesint, optional (default=100)

The total number of points generated.

shufflebool, optional (default=True)

Whether to shuffle the samples.

noisedouble or None (default=None)

Standard deviation of Gaussian noise added to the data.

random_stateint, RandomState instance or None (default)

Determines random number generation for dataset shuffling and noise. Pass an int for reproducible output across multiple function calls. See Glossary.

Returns
Xarray of shape [n_samples, 2]

The generated samples.

yarray of shape [n_samples]

The integer labels (0 or 1) for class membership of each sample.