model_sequential.compile(loss=losses.BinaryCrossentropy(from_logits=True),
optimizer=‘adam’,
metrics=[‘accuracy’])
why from_logits True?
model_sequential.compile(loss=losses.BinaryCrossentropy(from_logits=True),
optimizer=‘adam’,
metrics=[‘accuracy’])
why from_logits True?
That tells TensorFlow to automatically use a very efficient form of the softmax function in the output layer, instead of you specifying a less efficient softmax activation layer directly.
Please explain more about how it is efficient if we use from_logit = True?
What if we have a sigmoid activation function?
model_sequential = tf.keras.Sequential([
layers.Embedding(max_features, embedding_dim),
layers.GlobalAveragePooling1D(),
layers.Dense(1, activation=‘sigmoid’)
])
it’s confusing me.
If you have only one output unit, there is not much point in using from_logits = True - because you do not need softmax in that case. Just using sigmoid is perfectly fine.
I’m not a mentor for that course, so I do not know exactly what the model in that assignment is designed for. Perhaps a mentor for that course will reply also.
I sincerely appreciate your efforts to assist me.
This is actually a mistake. Thank you for spotting it! This course is newly updated and there are some mistakes here and there.
Cheers