sklearn.datasets.fetch_rcv1

sklearn.datasets.fetch_rcv1(data_home=None, subset='all', download_if_missing=True, random_state=None, shuffle=False, return_X_y=False)[source]

Load the RCV1 multilabel dataset (classification).

Download it if necessary.

Version: RCV1-v2, vectors, full sets, topics multilabels.

Classes 103
Samples total 804414
Dimensionality 47236
Features real, between 0 and 1

Read more in the User Guide.

New in version 0.17.

Parameters:
data_home : string, optional

Specify another download and cache folder for the datasets. By default all scikit-learn data is stored in ‘~/scikit_learn_data’ subfolders.

subset : string, ‘train’, ‘test’, or ‘all’, default=’all’

Select the dataset to load: ‘train’ for the training set (23149 samples), ‘test’ for the test set (781265 samples), ‘all’ for both, with the training samples first if shuffle is False. This follows the official LYRL2004 chronological split.

download_if_missing : boolean, default=True

If False, raise a IOError if the data is not locally available instead of trying to download the data from the source site.

random_state : int, RandomState instance or None (default)

Determines random number generation for dataset shuffling. Pass an int for reproducible output across multiple function calls. See Glossary.

shuffle : bool, default=False

Whether to shuffle dataset.

return_X_y : boolean, default=False.

If True, returns (dataset.data, dataset.target) instead of a Bunch object. See below for more information about the dataset.data and dataset.target object.

New in version 0.20.

Returns:
dataset : dict-like object with the following attributes:
dataset.data : scipy csr array, dtype np.float64, shape (804414, 47236)

The array has 0.16% of non zero values.

dataset.target : scipy csr array, dtype np.uint8, shape (804414, 103)

Each sample has a value of 1 in its categories, and 0 in others. The array has 3.15% of non zero values.

dataset.sample_id : numpy array, dtype np.uint32, shape (804414,)

Identification number of each sample, as ordered in dataset.data.

dataset.target_names : numpy array, dtype object, length (103)

Names of each target (RCV1 topics), as ordered in dataset.target.

dataset.DESCR : string

Description of the RCV1 dataset.

(data, target) : tuple if return_X_y is True

New in version 0.20.