February 2018
Intermediate to advanced
450 pages
11h 27m
English
In this section, we will write a function for creating the LSTM cell, which will be used in the hidden layer. This cell will be the building block for our model. So, we will create this cell using TensorFlow. Let's have a look at how we can use TensorFlow to build a basic LSTM cell.
We call the following line of code to create an LSTM cell with the parameter num_units representing the number of units in the hidden layer:
lstm_cell = tf.contrib.rnn.BasicLSTMCell(num_units)
To prevent overfitting, we can use something called dropout, which is a mechanism for preventing the model from overfitting the data by decreasing the model's complexity:
tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_probability)
As we mentioned ...
Read now
Unlock full access