Home > Mobile >  How to decide on activation function?
How to decide on activation function?

Time:01-26

Currently there are a lot of activation functions like sigmoid, tanh, ReLU ( being the preferred choice ), but I have a question that concerns which choices are needed to be considered so that a certain activation function should be selected.

For example : When we want to Upsample a network in GANs, we prefer using LeakyReLU.

I am a newbie in this subject, and have not found a concrete solution as to which activation function to use in different situations.

My knowledge uptil now :
Sigmoid : When you have a binary class to identify
Tanh : ?
ReLU : ?
LeakyReLU : When you want to upsample

Any help or article will be appreciated.

CodePudding user response:

This is an open research question. The choice of activation is also very intertwined with the architecture of the model and the computation / resources available so it's not something that can be answered in silo. The paper enter image description here

In the last layer we can use sigmoid in combination with the binary_crossentropy loss in order to use intuition from logistic regression - because we're just doing simple logistic regression on the learned features that the hidden layer gives to the last layer.

What types of features are learned depends on the activation function used in that hidden layer and the number of neurons in that hidden layer.

Here is what ReLU learns when using two hidden neurons:

enter image description here

And 10 hidden neurons:

enter image description here

Sigmoid and Tanh produce similar decsion boundaries (this is tanh https://miro.medium.com/max/2000/1*jynT0RkGsZFqt3WSFcez4w.gif - sigmoid is similar) which are more continuous and sinusoidal.

The main difference is that sigmoid is not zero-centered which doesn't make it a good choice for a hidden layer - especially in deep networks.

  •  Tags:  
  • Related