In the Course 4 Week 4 Assignment, it gives prediction of the next day temperature. How do I change the model to predict the next 5 consecutive days’ temperatures with the past 20 days temperatures?

Thank you!

I’m not a mentor for that course, but I’d guess you need to generate five sequential predictions, instead of just one.

Thanks, TMosh!

So, do the below, right?

- use the existing model predict for next day 1 with past 20 days data ending today
- use the existing model predict for next day 2 with past 19 days data ending today plus the predicted value for next day 1
- use the existing model predict for next day 3 with past 18 days data ending today plus the predicted value for next day 1 and 2.
- use the existing model predict for next day 4 with past 17 days data ending today plus the predicted value for next day 1, 2 and 3.
- use the existing model predict for next day 4 with past 16 days data ending today plus the predicted value for next day 1, 2, 3 and 4.

However, is it possible to change the model to give 5 outputs, each representing one future days’?

Sorry, I can’t answer that, as I have never seen this course’s materials.

In a Deep Learning Specialization class I took some time ago, I think this is what we called a moving average. If I am right about your situation,it is a recursive function. Please tell me if I am wrong. If not it might give you something to explore. Thanks.

Thanks, Doug!

In the Assignment, the model is defined something like below:

```
model = tf.keras.models.Sequential([
tf.keras.layers.Conv1D(32, kernel_size=[5], input_shape=[None, 1]),
tf.keras.layers.LSTM(32),
tf.keras.layers.Dense(48, activation='relu'),
tf.keras.layers.Dense(1, activation='relu')
])
```

The final output layer has only one Dense Neuron. So, can we change that to five Dense Neurons in the final output layer? Each output is used to predict the next day 1, 2, 3, 4 and 5 value respectively.

tf.keras.layers.Dense(5, activation=‘relu’)

Of course the training y (output) data is a vector of 5 values.

Thanks!