drej
04/25/2024, 5:57 PMmodels = [
LSTM(h=horizon,
max_steps=max_steps,
context_size=lookback,
scaler_type='robust',
hist_exog_list=['a', 'b'],
futr_exog_list=['c'],
encoder_hidden_size=32,
decoder_hidden_size=32
)
]
nf.fit(df=Y_df)
nf.predict() # NOT working
nf.predict(futr_df=futr_df) # working but not using hist features ??! 0_O
nf.predict(df=hist_df,futr_df=futr_df) # NOT working
nf.predict(hist_df) # NOT working
what am i missunderstanding / doing wrong?Marco
04/25/2024, 6:09 PMpredict
?drej
04/25/2024, 6:13 PMfutr_df
argument.Marco
04/25/2024, 6:16 PMdrej
04/25/2024, 6:18 PMnf.predict(futr_df=futr_df)
but then its using only future features to predict...drej
04/25/2024, 6:20 PMhist_exog_list
i need model taht predicts upon hist variables mostly; the futr is just to explain 1% extradrej
04/25/2024, 6:47 PMimport pandas as pd
import numpy as np
# bogus DATA
start_date = '2023-01-01'
end_date = '2023-01-07'
timestamps = pd.date_range(start=start_date, end=end_date, freq='H')
data = {
'ds': timestamps,
'a': np.random.rand(len(timestamps)),
'b': np.random.rand(len(timestamps)),
'c': np.random.rand(len(timestamps)),
'y': np.random.rand(len(timestamps)),
'unique_id': ['A'] * len(timestamps)
}
df = pd.DataFrame(data)
split_index = int(len(df) * 0.8)
train_df = df.iloc[:split_index]
test_df = df.iloc[split_index:]
futr_df = test_df[['c','ds','unique_id']].reset_index()
from neuralforecast import NeuralForecast
from neuralforecast.models import LSTM
horizon = 1
lookback=10
max_steps=1
models = [
LSTM(h=horizon,
max_steps=max_steps,
context_size=lookback,
scaler_type='robust',
hist_exog_list=['a', 'b'],
futr_exog_list=['c'],
encoder_hidden_size=32,
decoder_hidden_size=32
)
]
nf = NeuralForecast(models=models, freq='H')
nf.fit(df=train_df)
nf.predict(futr_df=futr_df) # working but i want hist dependent pred too
nf.predict() # NOT working
Marco
04/25/2024, 6:58 PMhist_exog_list
, the model uses that information to train and make predictions already. What you can do is also forecast your data in hist_exog_list
and pass it in the futr_df
.drej
04/25/2024, 7:16 PMMarco
04/25/2024, 7:38 PMdrej
04/25/2024, 7:53 PMdrej
04/25/2024, 7:58 PMdrej
04/25/2024, 8:06 PMnf.predict(df=test_df[:arb_time_Point] , futr_df=futr_df[:arb_time_Point+horizon])
Marco
04/25/2024, 8:12 PMdrej
04/29/2024, 10:43 PM