in a model I have trained I am applying softmax function in the output layer of the neural network. the output has 41 categories and I want to fetch the label with max value and the value itself ..i. e in the output. 41 diseases for a set of inputs ....the softmax predicts for all the diseases but I want to print the disease with maximum probability along with the probability how do I do it?
Asked
Active
Viewed 3,431 times
-1
-
Can you share what you have tried? Do you have example code that you are writing? – joshvito Jun 04 '19 at 18:20
1 Answers
2
You can achieve this by simply using the np.argmax()
function :
For example, to get the index of the disease with maximum probability of your first test example :
predictions = model.predict(x_test)
print(np.argmax(predictions[0]) #output the index of the disease with max proba
#for example N#0

Thibault Bacqueyrisses
- 2,281
- 1
- 6
- 18