title: LSTM Model not predict the result accurately
body: <pre><code># normalize the dataset
  scaler = MinMaxScaler(feature_range=(0, 1))
  dataset = scaler.fit_transform(df)
  
  train_size = int(len(dataset) * 0.8)
  test_size = len(dataset) - train_size
  train = dataset[0:train_size,:]
  test = dataset[train_size:len(dataset),:]
  
  # convert an array of values into a dataset matrix
  def create_dataset(dataset, look_back=1):
      dataX, dataY = [], []
      for i in range(len(dataset)-look_back-1):
          a = dataset[i:(i+look_back), 0]
          dataX.append(a)
          dataY.append(dataset[i + look_back, 0])
      return np.array(dataX), np.array(dataY)
    
    # reshape into X=t and Y=t+1
  look_back =50
  trainX, trainY = create_dataset(train, look_back)
  testX, testY = create_dataset(test, look_back)
  print(trainX.shape)
  
  # reshape input to be [samples, time steps, features]
  trainX = np.reshape(trainX, (trainX.shape[0], trainX.shape[1], 1))
  testX = np.reshape(testX, (testX.shape[0], testX.shape[1], 1))
  
  from keras.layers import Dropout
  from keras.layers import Bidirectional
  model=Sequential()
  model.add(LSTM(50,activation='relu',return_sequences=True,input_shape=(look_back,1)))
  model.add(Dense(50))
  model.add(LSTM(50, activation='relu', return_sequences=True))
  model.add(Dense(50))
  model.add(LSTM(50, activation='sigmoid', return_sequences=False))
  model.add(Dense(50))
  model.add(Dropout(0.2))
  model.add(Dense(1))
  model.compile(optimizer='adam',loss='mean_squared_error')
  
  Xdata_train=[]
  Ydata_train=[]
  
  Xdata_train, Ydata_train = create_dataset(train, look_back)
  Xdata_train = np.reshape(Xdata_train, (Xdata_train.shape[0], Xdata_train.shape[1], 1))
  
  #training for all data
  history = model.fit(Xdata_train,Ydata_train,batch_size=10,epochs=100,shuffle=True)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/JGfzJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JGfzJ.jpg" alt="Test &amp; Train Predictions" /></a>
  <a href="https://i.stack.imgur.com/T3Pxv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T3Pxv.jpg" alt="Predicted Results" /></a></p>
  <p>Here is the model I used. But the output results are not fit with the data. How to increase the. Predicted values have a low accuracy according to the graph.</p>
  <p>What are changes should do fix this issue?</p>