ROC Report¶
Imports¶
[1]:
from deepchecks.base import Dataset
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from deepchecks.checks.performance import RocReport
import pandas as pd
import warnings
def custom_formatwarning(msg, *args, **kwargs):
# ignore everything except the message
return str(msg) + '\n'
warnings.formatwarning = custom_formatwarning
Generating data:¶
[2]:
iris = load_iris(as_frame=True)
clf = LogisticRegression(penalty='none')
frame = iris.frame
X = iris.data
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=55)
clf.fit(X_train, y_train)
ds = Dataset(pd.concat([X_test, y_test], axis=1),
features=iris.feature_names,
label='target')
Running roc_report check:¶
[3]:
check = RocReport()
[4]:
check.run(ds, clf)
The marked points are the optimal threshold cut-off points. They are determined using Youden's index defined
as sensitivity + specificity - 1