File size: 1,230 Bytes
fcf6191 6849df4 |
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 60 61 62 63 64 65 |
---
license: mit
---
---
tags:
- tabular-classification
- sklearn
datasets:
- wine-quality
- imodels/compas-recidivism
---
### Load the data
```python
from datasets import load_dataset
import imodels
import numpy as np
from sklearn.model_selection import GridSearchCV
import joblib
dataset = load_dataset("imodels/compas-recidivism")
df = pd.DataFrame(dataset['train'])
X_train = df.drop(columns=['is_recid'])
y_train = df['is_recid'].values
df_test = pd.DataFrame(dataset['test'])
X_test = df.drop(columns=['is_recid'])
y_test = df['is_recid'].values
```
### Load the model
## Wine Quality classification
### A Simple Example of Scikit-learn Pipeline
> Inspired by https://towardsdatascience.com/a-simple-example-of-pipeline-in-machine-learning-with-scikit-learn-e726ffbb6976 by Saptashwa Bhattacharyya
### Load the model
```python
from huggingface_hub import hf_hub_url, cached_download
import joblib
import pandas as pd
REPO_ID = "imodels/figs-compas-recidivism"
FILENAME = "figs_model.joblib"
model = joblib.load(cached_download(
hf_hub_url(REPO_ID, FILENAME)
))
# model is a `imodels.FIGSClassifier`
```
### Make prediction
```
preds = model.predict(X_test)
print('accuracy', np.mean(preds==y_test))
```
|