What if the last layer is not sigmoid?

In the course 1, I’ve seen that all the last layers in programming assignment are of the sigmoid layer (i.e. only one neuron using the sigmoid activation function for binary classfication), What if I’ve got a numerical number to predict instead? What sort of activation function can I use in the last layer? Please give me some advice, thanks a lot.

You use the same linear activation (w*x + b) that was used in linear regression.

1 Like

thx, and change the compute_cost() and dAL accordingly, right? Can I use relu in the last layer as well? since the numerical number I’m gonna predict is always greater than or equal to zero.

Yes, you need to change the cost function, and any code that does backpropagation.

ReLU is never used in the output layer. It’s only used in hidden layers.

I see, many thanks!