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

class datasets.generators.classification.led.LED(ClassificationGenerator)

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']

Methods

generate (self) -> GeneratedData

Generate LED data.

Returns
GeneratedData
Generated dataset with feature array X of shape (n_samples, 7 + n_irrelevant) and digit labels y (0-9).
get_parameter_schema (cls) -> Dict[str, Any]

Return JSON Schema for constructor parameters.