fetch_online_news_popularity#

mlquantify.datasets.fetch_online_news_popularity(*, 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, threshold=1400)[source]#

Online News Popularity: will an article be popular? (binary, temporal).

39644 Mashable articles published over two years, described by 58 predictive features (token/link/keyword/NLP statistics; url and timedelta are dropped as non-predictive). The raw target is the continuous share count; it is binarised into popular (shares >= threshold, default 1400 = the dataset’s median).

Quantification: natural temporal prevalence drift in article popularity over time.

Samples

39644

Features

58 (real)

Classes

2 (popular 53.4% at >=1400)

Missing

0

Source: https://archive.ics.uci.edu/dataset/332/online+news+popularity

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.

thresholdint, default=1400

Share count at/above which an article counts as popular.

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

Fernandes, K. et al. (2015). EPIA 2015. UCI ML Repository (#332).

Examples

>>> b = fetch_online_news_popularity(threshold=1400); b.data.shape  
(39644, 58)