Fork me on GitHub

This documentation is for scikit-learn version 0.18.dev0Other versions

If you use the software, please consider citing scikit-learn.

sklearn.datasets.fetch_rcv1

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

Load the RCV1 multilabel dataset, downloading 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, optional (default=None)

Random state for shuffling the dataset. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

shuffle : bool, default=False

Whether to shuffle dataset.

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.

References

Lewis, D. D., Yang, Y., Rose, T. G., & Li, F. (2004). RCV1: A new benchmark collection for text categorization research. The Journal of Machine Learning Research, 5, 361-397.

Previous