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]
Return type

None

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

alibi.datasets.load_cats(target_size=(299, 299), return_X_y=False)[source]

A small sample of Imagenet-like public domain images of cats used primarily for examples. The images were hand-collected using flickr.com by searching for various cat types, filtered by images in the public domain.

Parameters
  • target_size (tuple) – Size of the returned images, used to crop images for a specified model input size

  • 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 – Bunch object with fields ‘data’, ‘target’ and ‘target_names’. Both targets and target_names are taken from the original Imagenet.

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