Hi everyone.
I am having a value error when using the rnn model to forecast in Assignment of C4W4.
It seems to be a mismatch of the data point number of x and y but I am certain where it comes from.
#plot the forecast
ValueError: x and y must have same first dimension, but have shapes (1150,) and (0,)
#print out mse and mae
InvalidArgumentError: Incompatible shapes: [0] vs. [1150] [Op:SquaredDifference]
Can someone please kindly take a glance of the code that I have?
I will send the note with my file separately if so.
Thanks, Anthony
Hey @Anthony_Lee ,
Please send me the code file!
Thanks and Regards,
Mayank Ghogale
Thanks. I don’t know why my rnn_forecast is not defined because the cell has it defined.
C4W4_Assignment.ipynb (110 KB)
I am currently out of station…will respond back as soon as possible sir
Thank you for your patience and cooperation
NameError Traceback (most recent call last)
in
1 # Compute the forecast for all the series
----> 2 rnn_forecast = model_forecast(model, G.SERIES, G.WINDOW_SIZE).squeeze
missing - ()
Correct
rnn_forecast = model_forecast(model, G.SERIES, G.WINDOW_SIZE).squeeze()
Your Model def:
tf.keras.layers.Conv1D(filters = 32, kernel_size = 5, strides = 1, padding = ‘causal’, activation = ‘relu’, input_shape = [None, 1]),
tf.keras.layers.LSTM(64, return_sequences = True),
tf.keras.layers.LSTM(64, return_sequences = True),
tf.keras.layers.Dense(30, activation = ‘relu’),
Solution:
Remove return_sequences = True from second LSTM layer because next layer is Dense not another LSTM.
Hello sir,
Sorry I kind of lost track because of my university work
Did your query get answered well sir?
Thanking you
Regards,
Mayank Ghogale