skmultiflow.data.base_stream.Stream

class skmultiflow.data.base_stream.Stream[source]

Base Stream class.

This abstract class defines the minimum requirements of a stream, so that it can work along other modules in scikit-multiflow.

Raises

NotImplementedError – This is an abstract class.:

__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__()

Initialize self.

get_data_info()

Retrieves minimum information from the stream

get_info()

Collects and returns the information about the configuration of the estimator

get_params([deep])

Get parameters for this estimator.

has_more_samples()

Checks if stream has more samples.

is_restartable()

Determine if the stream is restartable.

last_sample()

Retrieves last batch_size samples in the stream.

n_remaining_samples()

Returns the estimated number of remaining samples.

next_sample([batch_size])

Generates or returns next batch_size samples in the stream.

prepare_for_use()

Prepare the stream for use.

reset()

Resets the estimator to its initial state.

restart()

Restart the stream.

set_params(**params)

Set the parameters of this estimator.

Attributes

feature_names

Retrieve the names of the features.

n_cat_features

Retrieve the number of integer features.

n_features

Retrieve the number of features.

n_num_features

Retrieve the number of numerical features.

n_targets

Retrieve the number of targets

target_names

Retrieve the names of the targets

target_values

Retrieve all target_values in the stream for each target.

property feature_names

Retrieve the names of the features.

Returns

names of the features

Return type

list

get_data_info()[source]

Retrieves minimum information from the stream

Used by evaluator methods to id the stream.

The default format is: ‘Stream name - n_targets, n_classes, n_features’.

Returns

Stream data information

Return type

string

get_info()[source]

Collects and returns the information about the configuration of the estimator

Returns

Configuration of the estimator.

Return type

string

get_params(deep=True)[source]

Get parameters for this estimator.

Parameters

deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params – Parameter names mapped to their values.

Return type

mapping of string to any

has_more_samples()[source]

Checks if stream has more samples.

Returns

True if stream has more samples.

Return type

Boolean

is_restartable()[source]

Determine if the stream is restartable. :returns: True if stream is restartable. :rtype: Boolean

last_sample()[source]

Retrieves last batch_size samples in the stream.

Returns

A numpy.ndarray of shape (batch_size, n_features) and an array-like of shape (batch_size, n_targets), representing the next batch_size samples.

Return type

tuple or tuple list

property n_cat_features

Retrieve the number of integer features.

Returns

The number of integer features in the stream.

Return type

int

property n_features

Retrieve the number of features.

Returns

The total number of features.

Return type

int

property n_num_features

Retrieve the number of numerical features.

Returns

The number of numerical features in the stream.

Return type

int

n_remaining_samples()[source]

Returns the estimated number of remaining samples.

Returns

Remaining number of samples. -1 if infinite (e.g. generator)

Return type

int

property n_targets

Retrieve the number of targets

Returns

the number of targets in the stream.

Return type

int

abstract next_sample(batch_size=1)[source]

Generates or returns next batch_size samples in the stream.

Parameters

batch_size (int) – How many samples at a time to return.

Returns

A numpy.ndarray of shape (batch_size, n_features) and an array-like of size n_targets, representing the next batch_size samples.

Return type

tuple or tuple list

abstract prepare_for_use()[source]

Prepare the stream for use. Can be the reading of a file, or the generation of a function, or anything necessary for the stream to work after its initialization.

Notes

Every time a stream is created this function has to be called.

reset()[source]

Resets the estimator to its initial state.

Returns

Return type

self

restart()[source]

Restart the stream.

set_params(**params)[source]

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns

Return type

self

property target_names

Retrieve the names of the targets

Returns

the names of the targets in the stream.

Return type

list

property target_values

Retrieve all target_values in the stream for each target.

Returns

list of lists of all target_values for each target

Return type

list