YAML Metadata Error: "widget" must be an array

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
7
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train imodels/figs-compas-recidivism

Space using imodels/figs-compas-recidivism 1