we have our dataset preprocessed and split into train and test along with model object using the function get_seq_model(the next step is to simply train the model using the fit(function while modeling stock price information as sequencewe are assuming the whole time series as one big sequence hencewhile training the modelwe set the batch size as as there is only one stock to train in this case the following snippet gets the model object and then trains the same using the fit(function in [ ]get the model seq_lstm_model get_seq_model(input_shape=(train_x shape[ ], )verbose=verbosetrain the model seq_lstm_model fit(train_xtrain_yepochs= batch_size= verbose= this snippet returns model object along with its summary we also see the output of each of the epochs while the model trains on the training data figure - rnn summary figure - shows the total parameters which the rnn tries to learna complete of them we urge you to explore the summary on the model prepared in the previous sectionthe results should surprise most (hintthis model has far few parameters to learn!this summary also points toward an important factthe shape of the first lstm layer this clearly shows that the model expects the inputs to adhere to this shape (the shape of the training datasetfor training as well as predicting since our test dataset is smaller (shape( , , ))we need some way to match the required shape while modeling sequences with rnnsit is common practice to pad sequences in order to match given shape usually in cases where there are multiple sequences to train upon (exampletext generation)the size of the longest sequence is used and the shorter ones are padded to match it we do so only for programmatic reasons and discard the padded values otherwise (see keras masking for more on thisthe padding utility is available from the keras preprocessing sequence module the following snippet pads the test dataset with post the actual data (you can choose between pre-pad and post padand then uses the padded sequence to predict/forecast we also calculate and print the rmse score of the forecast in [ ]pad input sequence testpredict pad_sequences(test_xmaxlen=train_x shape[ ]padding='post'dtype='float '