%reload_ext autoreload
%autoreload 2
%matplotlib inline

import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd

import kaggler
from kaggler.metrics import plot_curve

print(f"matplotlib: v{matplotlib.__version__}")
print(f"     numpy: v{np.__version__}")
print(f"    pandas: v{pd.__version__}")
print(f"   kaggler: v{kaggler.__version__}")

plt.style.use("fivethirtyeight")

n_sample = 10_000
seed = 42

np.random.seed(seed)

x1 = np.random.rand(n_sample)
x2 = np.random.rand(n_sample)
y = x1 - .1 * x1 * x2 + np.random.rand(n_sample)
y = (y > y.mean()).astype(int)

df = pd.DataFrame({"y": y, "x1": x1, "x2": x2})
df.head()

"""
Explanation: Plotting Examples
kaggler.metrics.plot_curve() plots the ROC or PR curve for the binary classificaiton target and its predictions.
End of explanation
"""


plot_curve(y, x1, kind="roc")

"""
Explanation: Plotting an ROC curve with an 1-D np.ndarray input
End of explanation
"""


plot_curve(y, [x1, x2], name=["x1", "x2"], kind="roc")

"""
Explanation: Plotting an ROC curve with two 1-D np.ndarray inputs
End of explanation
"""


plot_curve(y, df[["x1", "x2"]], kind="roc")

"""
Explanation: Plotting an ROC curve with pd.DataFrame
End of explanation
"""


plot_curve(y, df[["x1", "x2"]], kind="pr")

"""
Explanation: Plotting an PR curve with pd.DataFrame
End of explanation
"""


