SineGenerator#

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

Bases: Stream

An SineGenerator

>>> from capymoa.stream.generator import SineGenerator
...
>>> stream = SineGenerator()
>>> stream.next_instance()
LabeledInstance(
    Schema(generators.SineGenerator ),
    x=ndarray(..., 4),
    y_index=0,
    y_label='positive'
)
>>> stream.next_instance().x
array([0.96775591, 0.00611718, 0.9637048 , 0.93986539])
__init__(
instance_random_seed: int = 1,
classification_function: int = 1,
suppress_irrelevant_attributes: bool = False,
balance_classes: bool = False,
)[source]#

Construct a SineGenerator .

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

  • classification_function – Classification function used, as defined in the original paper.

  • suppress_irrelevant_attributes – Reduce the data to only contain 2 relevant numeric attributes

  • balance – Balance the number of instances of each class.

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.