WaveformGenerator#

class capymoa.stream.generator.WaveformGenerator[source]#

Bases: Stream

An Waveform Generator

>>> from capymoa.stream.generator import WaveformGenerator
...
>>> stream = WaveformGenerator()
>>> stream.next_instance()
LabeledInstance(
    Schema(generators.WaveformGenerator ),
    x=ndarray(..., 21),
    y_index=0,
    y_label='class1'
)
>>> stream.next_instance().x
array([-0.35222814, -0.65631772,  1.66984311,  1.3552564 ,  1.95122954,
        3.34644007,  4.75457662,  2.72801084,  3.40907743,  2.41282297,
        3.34658027,  2.42282518,  2.08432716,  0.78783527,  0.94201874,
        0.75833533, -0.82178614, -1.23317608, -0.52710197, -0.44639196,
       -2.026593  ])
__init__(instance_random_seed: int = 1, noise: bool = False)[source]#

Construct a WaveForm Generator .

Parameters:
  • instance_random_seed – Seed for random generation of instances, defaults to 1

  • noise – Adds noise for a total of 40 attributes

CLI_help() str[source]#

Return cli help string for the stream.

get_moa_stream() InstanceStream | None[source]#

Get the MOA stream object if it exists.

get_schema() Schema[source]#

Return the schema of the stream.

has_more_instances() bool[source]#

Return True if the stream have more instances to read.

next_instance() LabeledInstance | RegressionInstance[source]#

Return the next instance in the stream.

Raises:

ValueError – If the machine learning task is neither a regression nor a classification task.

Returns:

A labeled instances or a regression depending on the schema.

restart()[source]#

Restart the stream to read instances from the beginning.