Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.datasets`.make_moons

sklearn.datasets.make_moons(n_samples=100, *, shuffle=True, noise=None, random_state=None)

  Make two interleaving half circles.

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

  Parameters:
    n_samples int or tuple of shape (2,), dtype=int, default=100

      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.

    shuffle bool, default=True

      Whether to shuffle the samples.

    noise float, default=None

      Standard deviation of Gaussian noise added to the data.

    random_state int, RandomState instance or None, default=None

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

  Returns:
    X ndarray of shape (n_samples, 2)

      The generated samples.

    y ndarray of shape (n_samples,)

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

## Examples using `sklearn.datasets.make_moons`

Classifier comparison

Classifier comparison

Comparing different clustering algorithms on toy datasets

Comparing different clustering algorithms on toy datasets

Comparing different hierarchical linkage methods on toy datasets

Comparing different hierarchical linkage methods on toy datasets

Comparing anomaly detection algorithms for outlier detection on toy datasets

Comparing anomaly detection algorithms for outlier detection on toy datasets

Statistical comparison of models using grid search

Statistical comparison of models using grid search

Compare Stochastic learning strategies for MLPClassifier

Compare Stochastic learning strategies for MLPClassifier

Varying regularization in Multi-layer Perceptron

Varying regularization in Multi-layer Perceptron

Feature discretization

Feature discretization