I want to calculate and print roc_auc_score
to evaluate the performance of my random forest model. I am doing NLP, hence the data in y_test
and y_pred
are list of words, I vectorize them with the function pipe_vect.transform
, but when I print y_test
and y_pred
, they don't have the same dimension, here what I get:
print('y_pred dimension: ', y_pred.shape) #y_pred dimension: (417, 1)
print('y_test dimension: ', y_test.shape) #y_test dimension: (417,)
Therefore, I want to reshape y_test
and give it two dimension.
Here my code :
x_test_vect = pipe_vect.transform(x_test)
y_pred = model.predict_proba(x_test_vect)
auc_score = roc_auc_score(y_test, y_pred)
print('Performance du modèle :', auc_score)
which yields the following error:
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case.