AgrawalGenerator#
- class capymoa.stream.generator.AgrawalGenerator[source]#
Bases:
MOAStream
An Agrawal Generator
>>> from capymoa.stream.generator import AgrawalGenerator ... >>> stream = AgrawalGenerator() >>> stream.next_instance() LabeledInstance( Schema(generators.AgrawalGenerator ), x=[1.105e+05 0.000e+00 5.400e+01 3.000e+00 1.400e+01 4.000e+00 1.350e+05 3.000e+01 3.547e+05], y_index=1, y_label='groupB' ) >>> stream.next_instance().x array([1.40893779e+05, 0.00000000e+00, 4.40000000e+01, 4.00000000e+00, 1.90000000e+01, 7.00000000e+00, 1.35000000e+05, 2.00000000e+00, 3.95015339e+05])
- __init__(
- instance_random_seed: int = 1,
- classification_function: int = 1,
- peturbation: float = 0.05,
- balance_classes: bool = False,
Construct an Agrawal Generator
- Parameters:
instance_random_seed – Seed for random generation of instances.
classification_function – Classification function used, as defined in the original paper.
peturbation – The amount of peturbation (noise) introduced to numeric values
balance – Balance the number of instances of each class.
- __iter__() Iterator[_AnyInstance] [source]#
Get an iterator over the stream.
This will NOT restart the stream if it has already been iterated over. Please use the
restart()
method to restart the stream.- Yield:
An iterator over the stream.
- __next__() _AnyInstance [source]#
Get the next instance in the stream.
- Returns:
The next instance in the stream.