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
数据统计
数据评估
关于imodels/figs-compas-recidivism特别声明
本站Ai导航提供的imodels/figs-compas-recidivism都来源于网络,不保证外部链接的准确性和完整性,同时,对于该外部链接的指向,不由Ai导航实际控制,在2023年5月15日 下午3:19收录时,该网页上的内容,都属于合规合法,后期网页的内容如出现违规,可以直接联系网站管理员进行删除,Ai导航不承担任何责任。
相关导航
暂无评论...