imodels/figs-compas-recidivism
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
收录说明:
1、本网页并非 imodels/figs-compas-recidivism 官网网址页面,此页面内容编录于互联网,只作展示之用;
2、如果有与 imodels/figs-compas-recidivism 相关业务事宜,请访问其网站并获取联系方式;
3、本站与 imodels/figs-compas-recidivism 无任何关系,对于 imodels/figs-compas-recidivism 网站中的信息,请用户谨慎辨识其真伪。
4、本站收录 imodels/figs-compas-recidivism 时,此站内容访问正常,如遇跳转非法网站,有可能此网站被非法入侵或者已更换新网址,导致旧网址被非法使用,
5、如果你是网站站长或者负责人,不想被收录请邮件删除:i-hu#Foxmail.com (#换@)
前往AI网址导航