How to access class probabilities in keras?

I am training a model for which I need to report class probabilities instead of a single classification. I have three classes, and each training instance has one of three classes assigned to it.

I am trying to use Keras to create MLP. But I cannot figure out how to extract the final probabilities of a class for each class. I use it as a basic example: http://machinelearningmastery.com/regression-tutorial-keras-deep-learning-library-python/

Thank!

+4
source share
2 answers

You can use the method to predict your trained model

to predict

pred (self, x, batch_size = 32, verbose = 0)

, .

x: , Numpy ( Numpy, ). batch_size: integer. verbose: verbosity mode, 0 1.

Numpy.

model.predict(input_to_your_network)
+3

(nb_classes > 1), .

  • , . numpy_utils
  • _crossentropy (. Keras)
  • softmax (, 0 1) nb_classes .
  • . (nb_classes, 1), .
+5

Source: https://habr.com/ru/post/1669372/


All Articles