SHARE
TWEET

Untitled

a guest Jun 16th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trainingModel = keras.Sequential()
  2.  
  3. print('training_batch_size : ',training_batch_size, 'DataX.shape[1] : ',trainingDataX.shape[1],'DataX.shape[2] : ', trainingDataX.shape[2])
  4.  
  5. trainingModel.add(keras.layers.LSTM(numberOfNeurons
  6.                     , batch_input_shape=(training_batch_size, trainingDataX.shape[1], trainingDataX.shape[2])
  7.                     , return_sequences=True
  8.                     , stateful=True
  9.                     , dropout = keyDropOut))
  10.  
  11. for idx in range(numberOfLSTMLayers - 1):
  12.  
  13.     trainingModel.add(keras.layers.LSTM(
  14.         numberOfNeurons
  15.         , return_sequences= True
  16.         , dropout = keyDropOut * (idx +1)
  17.         ))
  18.  
  19. trainingModel.compile(optimizer='adam',loss='mean_squared_error')#,metrics=['accuracy'])
  20.  
  21. #Model Layer Shapes ========================
  22. for layer in trainingModel.layers:
  23.  
  24.     print('Input shape', layer.input_shape)
  25.     print('Output shape', layer.output_shape)
  26.  
  27.  
  28.  
  29. Output
  30. ===============
  31. training_batch_size :  96 trainingDataX.shape[1] :  10 trainingDataX.shape[2] :  4
  32. Model Layer Shapes
  33. Input shape (96, 10, 4)
  34. Output shape (96, 10, 5) *<<<THIS IS MY PROBLEM
  35. Input shape (96, 10, 5)
  36. Output shape (96, 10, 5)
  37. Input shape (96, 10, 5)
  38. Output shape (96, 10, 5)
  39.  
  40.  
  41. Finally when I fit the model, it trhows error like:
  42.  
  43. ValueError: A target array with shape (2880, 10, 4) was passed for an output of shape (96, 10, 5) while using as loss `mean_squared_error`. This loss expects targets to have the same shape as the output
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top