Swiss roll generator: a 2-D sheet rolled through 3-D space.
Samples points from a plane that has been curled into a spiral, optionally with a hole punched through it. Points that are close in 3-D can be far apart along the sheet, which is what makes it the standard test for manifold learning and dimensionality reduction.
Classes
Swiss Roll data generator.
Generates the classic Swiss Roll 3D manifold dataset. This is commonly used to test dimensionality reduction algorithms.
Constructor
__init__( self, n_samples: int = 100, noise: float = 0.0, hole: bool = False, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
noise
float
= 0.0
Standard deviation of Gaussian noise.
hole
bool
= False
Whether to include a hole in the middle.
random_state
int or None
= None
Random seed for reproducibility.
python
>>> from tuiml.datasets.generators.clustering import SwissRoll
>>> gen = SwissRoll(n_samples=1000, noise=0.1, random_state=0)
>>> data = gen.generate()
>>> data.X.shape # always 3-D
(1000, 3)