Moons generator: two interleaving half circles.
Produces a pair of crescents that curve into one another, with Gaussian jitter. Like
circles it is not linearly separable, but the clusters are elongated rather than nested.Classes
Two Moons data generator.
Generates two interleaving half circles (moons). This is a classic non-linearly separable dataset.
Constructor
__init__( self, n_samples: int = 100, noise: float = 0.1, shuffle: bool = True, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
noise
float
= 0.1
Standard deviation of Gaussian noise.
shuffle
bool
= True
Whether to shuffle the samples.
random_state
int or None
= None
Random seed for reproducibility.
python
>>> from tuiml.datasets.generators.clustering import Moons
>>> gen = Moons(n_samples=1000, noise=0.1, random_state=0)
>>> data = gen.generate()
>>> data.X.shape
(1000, 2)
>>> sorted(set(data.y.tolist()))
[0, 1]