Error in Lab notebook for Test Validation

I am not clear why the test validation is checking for “linear” when the model that is being created is requiring for a binary classification which should be sigmoid. When I use sigmoid the test fails. Need clarification if this is a error in the notebook ?

Apparently this question is from Week 2 Assignment 2.

If you look one cell below where you captured your image, you will see that the model is compiled using “from_logits = True”. When this is combined with using a linear output activation, this gives you a categorical output but uses a more computationally efficient method.

Week 2 - Convolutional Neural Networks - 2nd Assignment on Transfer Learning.

Assignment : Transfer Learning with MobileNet | Coursera

I was able to proceed the rest of the lab with activation function set to “sigmoid”, but this test fails and as a result I could not submit the assignment.

See my previous reply, I have edited it.
Do not use sigmoid() activation for this exercise.

If we don’t use sigmoid, then how will we satisfy this requirement that is asking for a binary classification in the exercise and that is a requirement for the lab:

use a prediction layer with one neuron (as a binary classifier only needs one)

outputs = tf.keras.layers.Dense(1, activation='sigmoid')(x)

Yes, but that is wrong as Tom pointed out. Here’s a thread about why the from_logits = True mode is used when we are dealing with either binary or multiclass classifiers with cross entropy loss functions.

Oh ok. thank you for the clarification.

Already answered - that’s what “from_logits = True” does.

It just means that the sigmoid is handled internally in the loss function and gradient calculations. But that also means that when you use the output of the model to make predictions, you need to either manually add the sigmoid to the output or change your criterion to \hat{y} > 0 means yes.

Thank you for the clarification. Yes I remember now on this.