NumpyStream#

class capymoa.stream.NumpyStream[source]#

Bases: Stream

A datastream originating from a numpy array.

__init__(
X: ndarray,
y: ndarray,
dataset_name='No_Name',
feature_names=None,
target_name=None,
target_type: str = None,
)[source]#

Construct a NumpyStream object from a numpy array.

Parameters:
  • X – Numpy array of shape (n_samples, n_features) with the feature values

  • y – Numpy array of shape (n_samples,) with the target values

  • dataset_name – The name to give to the datastream, defaults to “No_Name”

  • feature_names – The names given to the features, defaults to None

  • target_name – The name given to target values, defaults to None

  • target_type – ‘categorical’ or ‘numeric’ target, defaults to None

has_more_instances()[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.

get_schema()[source]#

Return the schema of the stream.

get_moa_stream()[source]#

Get the MOA stream object if it exists.

restart()[source]#

Restart the stream to read instances from the beginning.

CLI_help() str[source]#

Return cli help string for the stream.