lstm_autoencoder | LSTM Autoencoder that works with variable timesteps | Machine Learning library
kandi X-RAY | lstm_autoencoder Summary
kandi X-RAY | lstm_autoencoder Summary
A time serie can be described with an LSTM Autoencoder. Usually, LSTM's are required to have fixed timesteps in order for the decoder part of the autoencoder to know beforehand how many timesteps should produce. However, this version of LSTM Autoencoder allows to describe timeseries based on random samples with unfixed timesteps. In this LSTM autoencoder version, the decoder part is capable of producing, from an encoded version, as many timesteps as desired, serving the purposes of also predicting future steps.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encodes X
- Predict the autoencoder
- Fit the autoencoder
- Return the predictions for the model
- Display a pandas dataframe
- Generate a random sample
lstm_autoencoder Key Features
lstm_autoencoder Examples and Code Snippets
Community Discussions
Trending Discussions on lstm_autoencoder
QUESTION
I was looking the blog and the author used 'relu' instead of 'tanh', why? https://towardsdatascience.com/step-by-step-understanding-lstm-autoencoder-layers-ffab055b6352
...ANSWER
Answered 2020-Jul-08 at 16:12First, the ReLU function is not a cure-all activation function. Specifically, it still suffers from the exploding gradient problem, since it is unbounded in the positive domain. Implying, this problem would still exist in deeper LSTM networks. Most LSTM networks become very deep, so they have a decent chance of running into the exploding gradient problem. RNNs also have exploding gradients when using the same weight matrix at each time step. There are methods, such as gradient clipping, that help reduce this problem in RNNs. However, ReLU functions themselves do not solve the exploding gradient problem.
The ReLU function does help reduce the vanishing gradient problem, but it doesn't solve the vanishing gradient completely. Methods, such as batch normalization, can help reduce the vanishing gradient problem even further.
Now, to answer your question about using a ReLU function in place of a tanh function. As far as I know, there shouldn't be much of a difference between the ReLU and tanh activation functions on their own for this particular gate. Neither of them completely solve the vanishing/exploding gradient problems in LSTM networks. For more information about how LSTMs reduce the vanishing and exploding gradient problem, please refer to this post.
QUESTION
This is my simple reproducible code:
...ANSWER
Answered 2019-Jul-12 at 19:37The encoder
as you have defined it is a model, and it consists of two layers: an input layer and the 'encoder_lstm'
layer which is the bidirectional LSTM layer in the autoencoder. So its output shape would be the output shape of 'encoder_lstm'
layer which is (None, 20)
(because you have set LATENT_SIZE = 20
and merge_mode="sum"
). So the output shape is correct and clear.
However, since encoder
is a model, when you run encoder.get_weights()
it would return the weights of all the layers in the model as a list. The bidirectional LSTM consists of two separate LSTM layers. Each of those LSTM layers has 3 weights: the kernel, the recurrent kernel and the biases. So encoder.get_weights()
would return a list of 6 arrays, 3 for each of the LSTM layers. The first element of this list, as you have stored in weights
and is subject of your question, is the kernel of one of the LSTM layers. The kernel of an LSTM layer has a shape of (input_dim, 4 * lstm_units)
. The input dimension of 'encoder_lstm'
layer is VOCAB_SIZE
and its number of units is LATENT_SIZE
. Therefore, we have (VOCAB_SIZE, 4 * LATENT_SIZE) = (100, 80)
as the shape of kernel.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install lstm_autoencoder
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page