It is the sequence of the problems that can store the information. The process is done by importing numpy computation and matplotlib for plotting the graphs and manipulating datasets. The Keras is a network library written in Python that has a high-level which makes it simple and intuitive to use. It will work as a wrapper to low-level libraries. They are designed to enable fast experimentation with deep neural networks and focuses on being user-friendly, modular, and extensible. That supports convolution networks and recurrent networks as well as combinations of the two.
Also runs seamlessly on CPU and GPU.
LSTM:-
Import numpy as np
Import matplotlib.pyplot as plt
Import pandas as pd
In the first, line the pandas are imported and then the library is used to visualize the data as well used for manipulation of data.
In the second line, we need to show the graph at the end between the predicted value and actual value so matplotlib is imported that performs such act. plt.
And used to plot both the predicted as well as actual values
From 3rd step, the Sklearn is a library which is used for splitting the dataset into training and testing phase.
Also used to normalize the dataset and the Normalization is needed so that every value/column is set to a specified range and machine can learn dataset more accurately.
We need to convert the dataframe into a matrix hence numpy is used.
They will converts data into array and these arrays are fed to a machine for training purposes.
Keras will support two types of models one is the sequential and other is functional.
Sequential model is imported from Keras layers.
We need to import the test set and use to make predictions,
Dataset_test=pd.read_csv(‘tatatest.csv’)
Real_stock_price=dataser_test.iloc[:.1:2]
We need to do a couple of things after loading in the test set:-
Dataset_total=pd.concat ((dataset_train [‘Open’], dataset_test [‘open’], axis=0)
Inputs=dataset_total [len (dataset_total)-len (dataset_test)-60:].values
Inputs=inputs. reshape (-1, 1)
Inputs=sc.transform (inputs)
X_test= []
For I in range (60, 76):
X_test.append (inputs [i-60: I, 0])
X_test=np.array (x_test)
X_test=np.reshape (x_test, (X_test.shape [0], x_test.shape [1], 1))
Predicted_stock_price=regressor.predict (X_test))
Predicted_stock_price=sc.inverse_transform (predicted_stock_price)