# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: java-mentat
#     language: python
#     name: java-mentat
# ---

# # ROC

# +
import pandas as pd
from mentat import *
import seaborn as sns

sns.set(rc={"figure.dpi":100, 'savefig.dpi':100})
sns.set_context('notebook')
sns.set_style("ticks")
# -

data = pd.read_csv("./data/credit-bias-predictions.zip")

data.head()

labels = data.PaidLoan.astype(int).tolist()
probabilities = data.predicted_probabilities.tolist()

# +
from metrics import ROC

roc = ROC(labels, probabilities, 1000)
# -

x = list(roc.getFalsePositiveRates())
y = list(roc.getTruePositiveRates())

# +
import seaborn as sns
import numpy as np

ax = sns.lineplot(x=x, y=y, color="red")
ax.set(xlabel="False Positive Rate", ylabel="True Positive Rate", title="Receiver operating characteristic")
identity = np.linspace(0, 1, 1000)
sns.lineplot(x=identity, y=identity, linestyle='--', color="black")
# -



StarcoderdataJupyterScriptsDedupFiltered