Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.datasets`.make_swiss_roll

sklearn.datasets.make_swiss_roll(n_samples=100, *, noise=0.0, random_state=None, hole=False)

  Generate a swiss roll dataset.

  Read more in the User Guide.

  Parameters:
    n_samples int, default=100

      The number of sample points on the Swiss Roll.

    noise float, default=0.0

      The standard deviation of the gaussian noise.

    random_state int, RandomState instance or None, default=None

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

    hole bool, default=False

      If True generates the swiss roll with hole dataset.

  Returns:
    X ndarray of shape (n_samples, 3)

      The points.

    t ndarray of shape (n_samples,)

      The univariate position of the sample according to the main dimension of the points in the manifold.

  Notes

  The algorithm is from Marsland [1].

  References

  [1]

  S. Marsland, “Machine Learning: An Algorithmic Perspective”, 2nd edition, Chapter 6, 2014. https://homepages.ecs.vuw.ac.nz/~marslast/Code/Ch6/lle.py

## Examples using `sklearn.datasets.make_swiss_roll`

Hierarchical clustering: structured vs unstructured ward

Hierarchical clustering: structured vs unstructured ward

Swiss Roll And Swiss-Hole Reduction

Swiss Roll And Swiss-Hole Reduction