Edit model card

Load the data

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

from huggingface_hub import hf_hub_url, cached_download
import joblib
import pandas as pd

REPO_ID = "imodels/figs-compas-recidivism"
FILENAME = "sklearn_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))
# accuracy 0.6759165485112416
Downloads last month
2
Hosted inference API
Tabular Classification
Examples
Examples
This model can be loaded on the Inference API on-demand.

Dataset used to train imodels/figs-compas-recidivism