fuzzyclust.large.make_drifting_stream#

fuzzyclust.large.make_drifting_stream(n_chunks=20, chunk_size=2000, n_clusters=3, n_features=2, drift=0.15, spread=0.6, box=8.0, random_state=None)[source]#

A stream of chunks whose cluster centers drift from chunk to chunk.

Every chunk \(l\) holds chunk_size samples of n_clusters isotropic Gaussian clusters whose centers move by a constant drift vector per chunk (each cluster its own random direction, step length drift). A generator is returned, so that chunks can be consumed one by one with partial_fit().

Parameters:
n_chunksint, default=20
chunk_sizeint, default=2000
n_clustersint, default=3
n_featuresint, default=2
driftfloat, default=0.15

Displacement of every center per chunk.

spreadfloat, default=0.6
boxfloat, default=8.0
random_stateint, RandomState instance or None
Yields:
Xndarray of shape (chunk_size, n_features)
yndarray of shape (chunk_size,)
centersndarray of shape (n_clusters, n_features)

The true centers of this chunk.

Examples

>>> from fuzzyclust.large import make_drifting_stream
>>> chunks = list(make_drifting_stream(n_chunks=3, chunk_size=100, random_state=0))
>>> len(chunks), chunks[0][0].shape, chunks[-1][2].shape
(3, (100, 2), (3, 2))

Examples using fuzzyclust.large.make_drifting_stream#

Clustering a drifting stream chunk by chunk with partial_fit

Clustering a drifting stream chunk by chunk with partial_fit