Can LSTM model use ReLU or LeakyReLU as the activation funtion? If so, when should one use tanh and when should one use ReLU or LeakyReLU?
Yes, you can use ReLU or LeakyReLU in an LSTM model.
There aren't hard rules for choosing activation functions. Run your model with each activation function and pick the best performing one.
See the following academic papers on activation functions for LSTM:
- Towards activation function search for long short-term model network: A differential evolution based approach
- Flood Prediction using Deep Learning Models
The following are some more articles which may be of interest although they don't specifically address LSTMs:
- Activation Functions in Neural Networks [12 Types & Use Cases]
- How to Choose an Activation Function for Deep Learning
- How to Choose the Right Activation Function for Neural Networks
- Performance Analysis of Various Activation Functions Using LSTM Neural Network For Movie Recommendation Systems
- Activation Functions — All You Need To Know!
- ALReLU: A different approach on Leaky ReLU activation function to improve Neural Networks Performance
- Activation Functions Compared With Experiments
Yes an LSTM can use any of these.
There are no hard rules of which to use. That is why they all exist.
Some rules of thumb are:
Relu is the cheapest computationally. Almost always worth trying first.
If you find neurons are dying try leaky relu instead.
Tanh is probably not going to help and is much slower. Likely only worth trying if computational resources are plentiful