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_homestring, optional

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

subsetstring, ‘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_missingboolean, 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_stateint, RandomState instance or None (default)

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

shufflebool, default=False

Whether to shuffle dataset.

return_X_yboolean, 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
datasetdict-like object with the following attributes:
dataset.datascipy csr array, dtype np.float64, shape (804414, 47236)

The array has 0.16% of non zero values.

dataset.targetscipy 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_idnumpy array, dtype np.uint32, shape (804414,)

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

dataset.target_namesnumpy array, dtype object, length (103)

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

dataset.DESCRstring

Description of the RCV1 dataset.

(data, target)tuple if return_X_y is True

New in version 0.20.