You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are not preparing the data correctly as the latest price must be at the 0th index of the list. Model's forecast are also effected by this we can see the forecast was very high from the last price this was because the 0th index has a higher value than the actual price
Here are my observations: X_all[-2:]
Output:
This will correct the order of windows
New function:
def make_future_forecasts(
values,
model,
into_future,
window_size=WINDOW_SIZE
) -> list:
"""
Make future forecasts into_future steps after value ends.
Returns future forecasts as a list of floats.
"""
# Empty list of future forecast
future_forecast = []
# Get the last window of prices to feed to the model
last_window = values[-window_size:]
last_window = last_window[::-1]
# Make into_future number of preds altering the data which model will use for next pred
for _ in range(into_future):
# Predict on last window and append the pred in forecast and also in last window(model will predict on its own pred)
future_pred = model.predict(tf.expand_dims(last_window,axis=0))
print(f'Predicting on:\n {last_window}-> Prediction: {tf.squeeze(future_pred).numpy()}')
future_forecast.append(tf.squeeze(future_pred).numpy())
# Update last window
last_window=np.append(future_pred,last_window)[:window_size]
# Return list of forecast
return future_forecast
The text was updated successfully, but these errors were encountered:
We are not preparing the data correctly as the latest price must be at the 0th index of the list. Model's forecast are also effected by this we can see the forecast was very high from the last price this was because the 0th index has a higher value than the actual price
Here are my observations:
X_all[-2:]
Output:
See how the new price
45604.61575361
moved to the 0th indexSOLUTION:
This will correct the order of windows
New function:
The text was updated successfully, but these errors were encountered: