alibi.datasets.default module

alibi.datasets.default.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=True

alibi.datasets.default.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.default.fetch_imagenet_10(url_id=0)[source]

Sample dataset extracted from imagenet in a dictionary format. The train set contains 1000 random samples, 100 for each of the following 10 selected classes:

  • stingray

  • trilobite

  • centipede

  • slug

  • snail

  • Rhodesian ridgeback

  • beagle

  • golden retriever

  • sea lion

  • espresso

The test set contains 50 random samples, 5 for each of the classes above.

Parameters:

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

Return type:

Dict

Returns:

Dictionary with the following keys

  • trainset - train set tuple (X_train, y_train)

  • testset - test set tuple (X_test, y_test)

  • int_to_str_labels - map from target to target name

  • str_to_int_labels - map from target name to target

alibi.datasets.default.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=True.

alibi.datasets.default.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=True.