2

I am doing a multi-class classification problem with the target labels of 0, 1, and 2 (dtype=int). I built my model and want to evaluate how good it is using precision, recall, and f-score. Here's what I did:

precision,recall,fscore,support = precision_recall_fscore_support(y_train,y_train_pred)
print('recall:  {0}'.format(recall))

And here's my output:

recall:  [ 0.99991709  0.56711409  0.12327412]

I'm almost certain that the ordering is 0, 1, 2 from left to right. But I don't know for sure. Would someone please (1) confirm the ordering for me and (2) tell me how I can check the ordering? There must be some parameters where my label ordering is stored? What if my labels were "dog","bird","fish"? Would it have been alphabetical?

puifais
  • 738
  • 2
  • 9
  • 20

1 Answers1

2

precision,recall,fscore,support = precision_recall_fscore_support(y_train,y_train_pred,labels=[0,1,2])

Gives you 0, 1, 2 from left to right. Just like

precision,recall,fscore,support = precision_recall_fscore_support(y_train,y_train_pred,labels=['dog','bird','fish'])

Gives you 'dog','bird','fish' from left to right.

puifais
  • 738
  • 2
  • 9
  • 20