What’s the exact difference between the final prediction output of the preferred and non-preferred methods? Does the preferred method return a vector of z-values from 1 to N, and the non-preferred one returns a vector of probability a_1 to a_n?
Also, in the week 2 Softmax lab, I try to understand what the function: model.predict(X_train) returns. I know it has four columns because the target value of Y has four classes, but what do the rows stand for, and what factor influences the number of rows?
Thanks for helping!
What shape is your output from .predict(input) ?
What shape is your input ?
I am also wondering what you mean by “preferred methods”. Are you talking about the
from_logits feature? Can you elaborate more?
Yes, what I mean by the preferred methods is the from_logits feature, the one makes the model more numerically stable.
That’s the problem, apparently, since it’s a tuple, I can’t call its shape.
"softmax" is specified in the output layer, we set
"softmax" is specified in the output layer, the model outputs probabilities as you said.
The number of probabilities is equal to the number of classes.
"linear" is specified in the output layer, we set
"linear" is specified in the output layer, the model outputs logits.
The number of logits is equal to the number of classes.
I think you are referring the logits as
Number of samples to predict for.
Neither the input nor the output of Keras model.predict() is typically a tuple for the exercises in these classes. See
x Input samples. It could be:
- A Numpy array (or array-like), or a list of arrays (in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors (in case the model has multiple inputs).
- A generator or
keras.utils.Sequence instance. A more detailed description of unpacking behavior for iterator types (Dataset, generator, Sequence) is given in the
Unpacking behavior for iterator-like inputs section of
Numpy array(s) of predictions.
I had expected you would find that the input shape was something like (m,448,448,3) and the output shape (m,4). The clue, then, being the common first dimension which @rmwkwok points out is the number of inputs or samples.