In the graphing code for the Complex Model there is
np.argmax(tf.nn.softmax(model.predict(Xl)))
isn’t that equivalent to
np.argmax(model.predict(Xl))
since softmax doesn’t reorder its input?
you are right, softmax produces the probabilities of Xl
belonging to each of the classes, in the order of classes. np.argmax
returns the most probable class numbers.
Yes, that’s correct. Because softmax is a monotonic function, argmax will give you the same answer either with the “logits” or the softmax outputs as the input to argmax. The point is that they almost always define TF models with linear outputs (logits) at the output layer and then use from_logits = True mode in the cost function (the appropriate version of cross entropy), so that the activation calculation is done internally by the cost function.
2 Likes