Hi,
why isn’t the last element in series used to compute the moving average in the method defined.
forecast = []
for time in range(len(series) - window_size):
forecast.append(series[time:time + window_size].mean())
return np_forecast
If I take the example on a series w/ 5 data points :
series_tmp = np.array([10, 12, 8, 11, 9])
window_size = 2
Using he method defined in the course notebook I would get only 3 elements : [11.0, 10.0, 9.5].
Why don’t we use the following method :
forecast = [ ]
for time in range(len(series_tmp) - window_size + 1):
forecast.append(series_tmp[time:time + 2].mean())
The output would be : [11.0, 10.0, 9.5, 10.0]
Thanks for the explanation
Robin