Im tryng to optimize my code:
The original code is:
precision, recall , tresholds_2 =precision_recall_curve(y_test, predicted_scores[:,1], pos_label=1)
tresholds_3=np.append(tresholds_2,1)
The function I have tried to perform is:
def precision_recall_curve (test,scores):
precision, recall , tresholds_2 =precision_recall_curve(test, scores[:,1], pos_label=1)
tresholds_3=np.append(tresholds_2,1)
return ({precision, recall , tresholds_3})
And the mistake is:
from sklearn.metrics import precision_recall_curve
TBLE= precision_recall_curve(y_test,predicted_scores)
TBLE
-> 864 raise ValueError( 865 "y should be a 1d array, " 866 "got an array of shape {} instead.".format(shape))
ValueError: y should be a 1d array, got an array of shape (62499, 2) instead