How will i print the label of an output. If i give the first row of Xtest to model.predict. It returns an array. How to find out the label of the output i.e. if it is a dog or a cat etc ?
Output Prediction Label
you can create a dictionary of {‘array_index’ : class_name} For e.g {0:cat , 1: dog }. Lets say you are getting an output of [0,1]. Then pick out the index which gives 1. In this case, it is index=1. Now see the corresponding class in your dictionary for that index!
if the output is [1,0], then the index would be 0, as the 0th index of your output array gives 1. Now look for the corresponding value for the key_name=0, which is cat.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.