--- 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)) ```