skmultiflow.data.
WaveformGenerator
Waveform stream generator.
Generates instances with 21 numeric attributes and 3 classes, based on a random differentiation of some base waveforms. Supports noise addition, but in this case the generator will have 40 attribute instances
If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
if True additional 19 unrelated features will be added. (Default: False)
Examples
>>> # Imports >>> from skmultiflow.data.waveform_generator import WaveformGenerator >>> # Setting up the stream >>> stream = WaveformGenerator(random_state=774, has_noise=True) >>> # Retrieving one sample >>> stream.next_sample() (array([[ -3.87277692e-03, 5.35892351e-01, -6.07354638e-02, 1.70731601e+00, 5.34361689e-01, -1.77051944e-01, 1.14121806e+00, 1.35608518e-01, 1.41239266e+00, 3.54064724e+00, 3.07032776e+00, 4.51698567e+00, 4.68043133e+00, 3.56075018e+00, 3.83788037e+00, 2.71987164e+00, 4.77706723e-01, 2.12187988e+00, 1.59313816e+00, -5.11689592e-01, 5.99317674e-01, 2.14508816e-01, -1.05534090e+00, -1.34679419e-01, 5.32610078e-01, -1.39251668e+00, 1.13220325e+00, 3.04748552e-01, 1.41454012e+00, 6.73651106e-01, 1.85981832e-01, -1.76774471e+00, 3.31777766e-02, 8.17011922e-02, 1.70686324e+00, 1.10471095e+00, -5.08874759e-01, 4.16279862e-01, -4.26805543e-01, 9.94596567e-01]]), array([ 2.])) >>> # Retrieving 2 samples >>> stream.next_sample(2) (array([[ -6.72385828e-01, 1.51039782e+00, 5.64599422e-01, 2.77481410e+00, 2.27653785e+00, 4.40016488e+00, 3.87856303e+00, 4.90321750e+00, 4.40651078e+00, 5.07337409e+00, 3.23727692e+00, 2.99724461e+00, 1.46384329e+00, 1.30042173e+00, 3.67083253e-02, 3.80546239e-01, -2.05337011e+00, 6.06889589e-01, -1.10649679e+00, 3.38098465e-01, -8.33683681e-01, -3.35283052e-02, -6.65394037e-01, -1.09290608e+00, 4.15778821e-01, 3.64210364e-01, 1.18695445e+00, 2.77980322e-01, 8.69224059e-01, -4.93428014e-01, -1.08745643e+00, -9.80906438e-01, 4.12116697e-01, 2.39579703e-01, 1.53145126e+00, 6.26022691e-01, 9.82996997e-02, 8.33911055e-01, 8.55830752e-02, 1.54462877e+00], [ 3.34017183e-01, -5.00919347e-01, 2.67311051e+00, 3.23473039e+00, 2.04091185e+00, 5.62868585e+00, 4.79611194e+00, 4.14500688e+00, 5.76366418e+00, 4.18105491e+00, 4.73064582e+00, 3.03461230e+00, 1.79417942e+00, -9.84100765e-01, 1.34212863e+00, 1.29337991e-01, 6.08571939e-01, -8.56504577e-01, 2.95358587e-01, 9.12880505e-01, 2.88118824e-01, -4.49398914e-01, 5.44025828e-03, -1.78535212e+00, 1.41541455e-01, -6.91216596e-01, -8.66808201e-02, -1.27541907e-01, -5.38038710e-01, -1.19807563e+00, 1.03113317e+00, 2.39999025e-01, 5.24084853e-02, 1.04314518e+00, 3.20412032e+00, 1.26117112e+00, -7.10479419e-01, 4.60132194e-01, -5.63210805e-02, -1.56883271e-01]]), array([ 1., 1.])) >>> # Generators will have infinite remaining instances, so it returns -1 >>> stream.n_remaining_samples() -1 >>> stream.has_more_samples() True
Methods
get_data_info(self)
get_data_info
Retrieves minimum information from the stream
get_info(self)
get_info
Collects and returns the information about the configuration of the estimator
get_params(self[, deep])
get_params
Get parameters for this estimator.
has_more_samples(self)
has_more_samples
Checks if stream has more samples.
is_restartable(self)
is_restartable
Determine if the stream is restartable.
last_sample(self)
last_sample
Retrieves last batch_size samples in the stream.
n_remaining_samples(self)
n_remaining_samples
Returns the estimated number of remaining samples.
next_sample(self[, batch_size])
next_sample
Returns next sample from the stream.
prepare_for_use()
prepare_for_use
Prepare the stream for use.
reset(self)
reset
Resets the estimator to its initial state.
restart(self)
restart
Restart the stream.
set_params(self, **params)
set_params
Set the parameters of this estimator.
Attributes
feature_names
Retrieve the names of the features.
has_noise
Retrieve the value of the option: add noise.
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.
names of the features
Used by evaluator methods to id the stream.
The default format is: ‘Stream name - n_targets, n_classes, n_features’.
Stream data information
Configuration of the estimator.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
True if stream has more samples.
True is the noise is added.
True if stream is restartable.
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.
The number of integer features in the stream.
The total number of features.
The number of numerical features in the stream.
Remaining number of samples. -1 if infinite (e.g. generator)
the number of targets in the stream.
An instance is generated based on the parameters passed. If noise is included the total number of features will be 40, if it’s not included there will be 21 attributes. In both cases there is one classification task, which chooses one between three labels.
After the number of attributes is chosen, the algorithm will randomly choose one of the hard coded waveforms, as well as random multipliers. For each attribute, the actual value generated will be a a combination of the hard coded functions, with the multipliers and a random value.
Furthermore, if noise is added the features from 21 to 40 will be replaced with a random normal value.
The number of samples to return.
Return a tuple with the features matrix and the labels matrix for the batch_size samples that were requested.
Deprecated in v0.5.0 and will be removed in v0.7.0
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.
<component>__<parameter>
the names of the targets in the stream.
list of lists of all target_values for each target