aif360.sklearn.datasets
.fetch_bank
- aif360.sklearn.datasets.fetch_bank(*, data_home=None, cache=True, binary_age=True, percent10=False, usecols=None, dropcols=['duration'], numeric_only=False, dropna=False)[source]
Load the Bank Marketing Dataset.
The protected attribute is ‘age’ (binarized by default as suggested by [1]: age >= 25 and age <60 is considered privileged and age< 25 or age >= 60 unprivileged; see the binary_age flag to keep this continuous). The outcome variable is ‘deposit’: ‘yes’ or ‘no’.
References
Note
By default, the data is downloaded from OpenML. See the bank-marketing page for details.
- Parameters:
data_home (string, optional) – Specify another download and cache folder for the datasets. By default all AIF360 datasets are stored in ‘aif360/sklearn/data/raw’ subfolders.
cache (bool) – Whether to cache downloaded datasets.
percent10 (bool, optional) – Download the reduced version (10% of data).
usecols (list-like, optional) – Column name(s) to keep. All others are dropped.
dropcols (list-like, optional) – Column name(s) to drop.
numeric_only (bool) – Drop all non-numeric feature columns.
dropna (bool) – Drop rows with NAs. Note: this is False by default for this dataset.
- Returns:
namedtuple – Tuple containing X and y for the Bank dataset accessible by index or name.
See also
Examples
>>> bank = fetch_bank() >>> bank.X.shape (45211, 15)
>>> bank_nona = fetch_bank(dropna=True) >>> bank_nona.X.shape (7842, 15)
>>> bank_num = fetch_bank(numeric_only=True) >>> bank_num.X.shape (45211, 6)