Ok, now I kinda figured out what's going on.
I wrote down this line of code to see what happened:
print(tpr_values)
print(fpr_values)
The out put:
(0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855, 0.42857142857142855)
(0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006, 0.09575713240673006)
All of the values are the same. So they all concentrate on the same points.
I solved my own problem. The output is normal now:

The bug was here:
roc_values = []
for thresh in np.linspace(0, 1, 100):
preds = get_preds(thresh, probas)
tn, fp, fn, tp = confusion_matrix(y_test, log_preds).ravel()
tpr = tp/(tp+fn)
fpr = fp/(fp+tn)
roc_values.append([tpr, fpr])
tpr_values, fpr_values = zip(*roc_values)
After I fixed the log_preds
, it looks like this:
roc_values = []
for thresh in np.linspace(0, 1, 100):
preds = get_preds(thresh, probas) #~~~~~~~~
tn, fp, fn, tp = confusion_matrix(y_test, preds).ravel()
tpr = tp/(tp+fn) #^^^^^^^^
fpr = fp/(fp+tn)
roc_values.append([tpr, fpr])
tpr_values, fpr_values = zip(*roc_values)
It's quite frustrating, but whatever, it finally worked.