File size: 1,316 Bytes
aa2d71d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
annotations_creators: []
language: []
language_creators: []
license: []
multilinguality: []
pretty_name: credit-card
size_categories:
- 10K<n<100K
source_datasets: []
tags:
- interpretability
- fairness
- medicine
task_categories:
- tabular-classification
task_ids: []
---

Port of the credit-card dataset from UCI (link [here](https://www.kaggle.com/datasets/uciml/default-of-credit-card-clients-dataset)). See details there and use carefully.

Basic preprocessing done by the [imodels team](https://github.com/csinva/imodels) in [this notebook](https://github.com/csinva/imodels-data/blob/master/notebooks_fetch_data/00_get_datasets_custom.ipynb).

The target is the binary outcome `default.payment.next.month`.

### Sample usage

Load the data:

```
from datasets import load_dataset

dataset = load_dataset("imodels/credit-card")
df = pd.DataFrame(dataset['train'])
X = df.drop(columns=['default.payment.next.month'])
y = df['default.payment.next.month'].values
```

Fit a model:

```
import imodels
import numpy as np

m = imodels.FIGSClassifier(max_rules=5)
m.fit(X, y)
print(m)
```


Evaluate:


```
df_test = pd.DataFrame(dataset['test'])
X_test = df.drop(columns=['default.payment.next.month'])
y_test = df['default.payment.next.month'].values
print('accuracy', np.mean(m.predict(X_test) == y_test))
```