Circles generator: two concentric rings.
Produces a small ring nested inside a large one, with Gaussian jitter. The two classes cannot be separated by any straight line, so it is a quick way to show where linear models fail and kernel or density-based methods succeed.
Classes
Concentric Circles data generator.
Generates two concentric circles (inner and outer). This is a classic non-linearly separable dataset.
Constructor
__init__( self, n_samples: int = 100, noise: float = 0.05, factor: float = 0.5, shuffle: bool = True, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
noise
float
= 0.05
Standard deviation of Gaussian noise.
factor
float
= 0.5
Scale factor between inner and outer circle (0 < factor < 1).
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 Circles
>>> gen = Circles(n_samples=1000, noise=0.05, factor=0.5, random_state=0)
>>> data = gen.generate()
>>> data.X.shape
(1000, 2)
>>> sorted(set(data.y.tolist())) # 0 = outer ring, 1 = inner ring
[0, 1]