alibi.datasets module

alibi.datasets.fetch_adult(features_drop=None, return_X_y=False, url_id=0)[source]

Downloads and pre-processes ‘adult’ dataset. More info: http://mlr.cs.umass.edu/ml/machine-learning-databases/adult/

Parameters
  • features_drop (Optional[list]) – List of features to be dropped from dataset, by default drops [“fnlwgt”, “Education-Num”]

  • return_X_y (bool) – If true, return features X and labels y as numpy arrays, if False return a Bunch object

  • url_id (int) – Index specifying which URL to use for downloading

Return type

Union[Bunch, Tuple[ndarray, ndarray]]

Returns

  • Bunch – Dataset, labels, a list of features and a dictionary containing a list with the potential categories for each categorical feature where the key refers to the feature column.

  • (data, target) – Tuple if return_X_y is true

alibi.datasets.fetch_fashion_mnist(return_X_y=False)[source]

Loads the Fashion MNIST dataset.

Parameters

return_X_y (bool) – If True, an NxMxP array of data points and N-array of labels are returned instead of a dict.

Returns

  • If return_X_y is False, a Bunch object with fields ‘data’, ‘targets’ and ‘target_names’

  • is returned. Otherwise an array with data points and an array of labels is returned.

alibi.datasets.fetch_imagenet(category='Persian cat', nb_images=10, target_size=(299, 299), min_std=10.0, seed=42, return_X_y=False)[source]

Retrieve imagenet images from specified category which needs to be in the mapping dictionary.

Parameters
  • category (str) – Imagenet category in mapping keys

  • nb_images (int) – Number of images to be retrieved

  • target_size (tuple) – Size of the returned images

  • min_std (float) – Min standard deviation of image pixels. Images that are no longer available can be returned without content which is undesirable. Having a min std cutoff resolves this.

  • seed (int) – Random seed

  • return_X_y (bool) – If true, return features X and labels y as numpy arrays, if False return a Bunch object

Return type

Union[Bunch, Tuple[ndarray, ndarray]]

Returns

  • Bunch – List with images and the labels from imagenet.

  • (data, target) – Tuple if return_X_y is true

alibi.datasets.fetch_movie_sentiment(return_X_y=False, url_id=0)[source]

The movie review dataset, equally split between negative and positive reviews.

Parameters
  • return_X_y (bool) – If true, return features X and labels y as Python lists, if False return a Bunch object

  • url_id (int) – Index specifying which URL to use for downloading

Return type

Union[Bunch, Tuple[list, list]]

Returns

  • Bunch – Movie reviews and sentiment labels (0 means ‘negative’ and 1 means ‘positive’).

  • (data, target) – Tuple if return_X_y is true