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

# +
import numpy as np
from sklearn.datasets import make_classification
from sklearn.ensemble import GradientBoostingClassifier

from binaryclassifier import Analyzer

X, y = make_classification(1000, class_sep=0.1, random_state=12)

clf = GradientBoostingClassifier(random_state=123, n_estimators=20, max_depth=2)
clf.fit(X, y)

scores = clf.predict_proba(X)[:,1]
preds = np.where(scores > 0.5, 1, 0)
# -

analyzer = Analyzer(y, scores, preds)

analyzer.plot_roc_curve()

analyzer.plot_prediction_density()

analyzer.plot_quantiles(q=10)

analyzer.plot_ks(q=10)

analyzer.plot_confusion_matrix(normalize=True)

analyzer.plot_precision_recall(mark_threshold=0.5)



StarcoderdataJupyterScriptsDedupFiltered