skmultiflow.data.
RandomRBFGenerator
Random Radial Basis Function stream generator.
Produces a radial basis function stream. A number of centroids, having a random central position, a standard deviation, a class label and weight, are generated. A new sample is created by choosing one of the centroids at random, taking into account their weights, and offsetting the attributes at a random direction from the centroid’s center. The offset length is drawn from a Gaussian distribution.
This process will create a normally distributed hypersphere of samples on the surrounds of each centroid.
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..
The number of class labels to generate.
The number of numerical features to generate.
The number of centroids to generate.
Examples
>>> # Imports >>> from skmultiflow.data.random_rbf_generator import RandomRBFGenerator >>> # Setting up the stream >>> stream = RandomRBFGenerator(model_random_state=99, sample_random_state=50, n_classes=4, ... n_features=10, n_centroids=50) >>> # Retrieving one sample >>> stream.next_sample() (array([[ 0.44952282, 1.09201096, 0.34778443, 0.92181679, 0.19503463, 0.28834419, 0.8293168 , 0.26847952, 0.8096243 , 0.23850379]]), array([[ 3.]])) >>> # Retrieving 10 samples >>> stream.next_sample(10) (array([[ 0.70374896, 0.65752835, 0.20343463, 0.56136917, 0.76659286, 0.61081231, 0.60453064, 0.88734577, -0.04244631, 0.09146432], [ 0.27797196, 0.05640135, 0.80946171, 0.60572837, 0.95080656, 0.25512099, 0.73992469, 0.33917142, 0.17104577, 0.79283295], [ 0.33696167, 0.10923638, 0.85987231, 0.61868598, 0.85755211, 0.19469184, 0.66750447, 0.27684404, 0.1554274 , 0.76262286], [ 0.71886223, 0.23078927, 0.45013806, 0.03019141, 0.42679505, 0.03841721, 0.34318517, 0.11769923, 0.9644654 , 0.01635577], [-0.01849262, 0.92570731, 0.87564868, 0.49372553, 0.39717634, 0.46697609, 0.41329831, 0.27652149, 0.12724455, 0.24658299], [ 0.81850217, 0.87228851, 0.18873385, -0.04254749, 0.06942877, 0.55567756, 0.97660009, 0.0273206 , 0.67995834, 0.49135807], [ 0.69888163, 0.61994977, 0.43074298, 0.27526838, 0.69566798, 0.91059369, 0.04680901, 0.50453698, 0.61394089, 0.92275292], [ 1.01929588, 0.80181051, 0.50547533, 0.14715636, 0.42889167, 0.61513174, 0.21752655, -0.52958207, 1.35091672, 0.38769673], [ 0.37738633, 0.60922205, 0.64216064, 0.90009707, 0.91787083, 0.36189554, 0.35438165, 0.28510134, 0.55301333, 0.21450072], [ 0.62185359, 0.75178244, 1.00436662, 0.24412816, 0.41070861, 0.52547739, 0.50978735, 0.79445216, 0.77589569, 0.16214271]]), array([[ 3.], [ 3.], [ 3.], [ 2.], [ 3.], [ 2.], [ 0.], [ 2.], [ 0.], [ 2.]])) >>> # 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.
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 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.
Return batch_size samples generated by choosing a centroid at random and randomly offsetting its attributes so that it is placed inside the hypersphere of that centroid.
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