bmg
bmg

Reputation: 1

Keras softmax probabilities

I'm trying to get softmax probabilities from a net whose last layer is a softmax layer and when I use model.predict() I get classes instead probabilities. Could anyone tell how to get probabilities.

 model = Sequential() 
 model.add(Convolution2D(32, 3, 3,input_shape=(32, 32, 3))) 
 model.add(MaxPooling2D((2, 2))) 
 model.add(Dropout(0.5))
 model.add(Activation('relu'))
 model.add(Convolution2D(32, 3, 3))
 model.add(MaxPooling2D((2, 2))) 
 model.add(Dropout(0.5))
 model.add(Activation('relu'))
 model.add(Flatten())      
 model.add(Dense(128))
 model.add(Activation('relu')) 
 model.add(Dense(43)) 
 model.add(Activation('softmax'))

Upvotes: 0

Views: 949

Answers (1)

Daniel GL
Daniel GL

Reputation: 1249

Your model's outputs will be values between 0 and 1. Your model should give a vector of size 43 and the sum of all outputs will add to one.

Depending on your training, these "probabilities" will often be almost one for the selected class if similar to the training examples, showing that the model was well trained.

Upvotes: 1

Related Questions