fetch_sea_concepts#

mlquantify.datasets.fetch_sea_concepts(*, data_home=None, download_if_missing=True, return_X_y=False, as_frame=False, n_retries=3, delay=1.0, protocol=None, n_samples=1000, sample_size=500, random_state=None, n=50000, drift=True, noise=0.1)[source]#

SEA Concepts: synthetic stream with abrupt concept drift (binary).

A pure-Python generator of the SEA stream (Street & Kim, 2001). Three features are drawn uniformly in [0, 10]; only the first two decide the label via f1 + f2 <= theta (the third is irrelevant). With drift=True the threshold theta changes across four equal blocks (8, 9, 7, 9.5), and noise flips a fraction of labels.

Quantification: controllable concept drift to isolate concept-shift behaviour.

Samples

n (default 50000)

Features

3 (real; 1 irrelevant)

Classes

2

Drift

4 concepts (abrupt)

Source: generated in pure Python (no download)

Parameters:
data_homestr or path-like, default=None

Folder used to cache the downloaded file(s); defaults to _data/ next to the package.

download_if_missingbool, default=True

If False, raise instead of downloading when the cache is empty.

return_X_ybool, default=False

Return (X, y) instead of a Bunch.

as_framebool, default=False

Return .data as a DataFrame, .target as a Series, and a combined .frame (features + a "target" column).

n_retriesint, default=3

Number of download attempts before giving up.

delayfloat, default=1.0

Seconds to wait between attempts.

protocol{None, “app”, “npp”, “upp”, “ppp”} or mlquantify protocol, default=None

If set, draw evaluation sample-bags with an mlquantify protocol; the Bunch then also has .samples (index bags into .data), .prevalences and .protocol.

n_samplesint, default=1000

Number of prevalence points (bags) generated by the protocol.

sample_sizeint, default=500

Instances per bag (the protocol batch_size).

random_stateint or None, default=None

Seed forwarded to the protocol.

nint, default=50000

Number of instances to generate.

driftbool, default=True

If True, cycle through four concepts (thresholds 8/9/7/9.5).

noisefloat, default=0.1

Fraction of labels randomly flipped.

Returns:
dataBunch

Dictionary-like object. Attributes: data (features), target (labels), feature_names, target_names, DESCR; frame when as_frame=True; and samples / prevalences / protocol when protocol is set.

(X, y)tuple

Returned instead when return_X_y=True.

References

Street, W. & Kim, Y. (2001). A streaming ensemble algorithm (SEA). KDD 2001.

Examples

>>> b = fetch_sea_concepts(n=10000, drift=True); b.data.shape
(10000, 3)