LED generator: seven-segment digit recognition.
Encodes the digits 0-9 as the seven segments of an LED display, inverting each segment with a fixed probability. Irrelevant attributes can be appended on top, making it a common benchmark for feature selection and for noise robustness.
Classes
LED (Light Emitting Diode) data generator.
Generates data simulating a seven-segment LED display that shows digits 0-9. Each segment has a probability of being inverted (noise).
The seven segments are numbered clockwise from the top:
_0_ | | 1 2 |_3_| | | 4 5 |_6_|
Constructor
__init__( self, n_samples: int = 100, noise: float = 0.1, n_irrelevant: int = 17, random_state: Optional[int] = None, )
Parameters
n_samples
int
= 100
Number of samples to generate.
noise
float
= 0.1
Probability of segment inversion (0.0-1.0).
n_irrelevant
int
= 17
Number of irrelevant attributes to add.
random_state
int or None
= None
Random seed for reproducibility.
python
>>> from tuiml.datasets.generators.classification import LED
>>> gen = LED(n_samples=1000, noise=0.1, random_state=0)
>>> data = gen.generate()
>>> data.X.shape # 7 segments + 17 irrelevant attributes
(1000, 24)
>>> data.feature_names[:3]
['seg0', 'seg1', 'seg2']