Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are missing combinations of ids and times in futr_df. #979

Open
Cuvi3 opened this issue Apr 23, 2024 · 13 comments
Open

There are missing combinations of ids and times in futr_df. #979

Cuvi3 opened this issue Apr 23, 2024 · 13 comments

Comments

@Cuvi3
Copy link

Cuvi3 commented Apr 23, 2024

What happened + What you expected to happen

When I use PatchTST for stock price prediction, the following error occured in nf.predict(futr_df=y_test):There are missing combinations of ids and times in futr_df.My data is stock prices for the last ten years, and since stocks don't trade during the holidays, there are no stock prices during those times, so the 'ds' in my data is not completely continuous

Versions / Dependencies

pytorch
neuralforcast

Reproduction script

model = PatchTST(h=17,
input_size=100,
patch_len=24,
stride=24,
revin=False,
hidden_size=16,
n_heads=4,
scaler_type='robust',
loss=MAE(),
learning_rate=1e-3,
max_steps=500,
val_check_steps=50,
early_stop_patience_steps=2)

nf = NeuralForecast(
models=[model],
freq='D'
)
nf.fit(df=y_train, val_size=17)
forecasts = nf.predict(futr_df=y_test)

Issue Severity

High: It blocks me from completing my task.

@Cuvi3 Cuvi3 added the bug label Apr 23, 2024
@jmoralez
Copy link
Member

Does it work if you set freq='B'? Otherwise you can just use the nf.make_future_dataframe() method to build the dates and replace your vales in there.

@Cuvi3
Copy link
Author

Cuvi3 commented Apr 24, 2024

Does it work if you set freq='B'? Otherwise you can just use the nf.make_future_dataframe() method to build the dates and replace your vales in there.

Yes, I had tried to set freq='B', but it didn't work, I got the same error again. And I have used the nf.make_future_dataframe() to deal with my y_test, it just produced two columns of data :unique_id and ds, and the time series in the ds is still discontinuous.When I combined these two new columns of data with the original data y and use the nf.predict(), the same problem still occured

@jmoralez
Copy link
Member

When I combined these two new columns of data with the original data y and use the nf.predict(), the same problem still occured

This is very unlikely, since that's the structure used by predict. If you can provide a reproducible example of that behavior we can help further.

@Cuvi3
Copy link
Author

Cuvi3 commented May 6, 2024

This is very unlikely, since that's the structure used by predict. If you can provide a reproducible example of that behavior we can help further.

Sorry,it's my fault that i didn't use the nf.make_future_dataframe() correctly,I have corrected my mistakes and got continuous ds data,then I used the nf.predict(futr_df=y_test),but the same error occured again,the y_test data is shown in the picture.
y_test

@jmoralez
Copy link
Member

jmoralez commented May 6, 2024

Are you providing the target as a future exogenous feature? If you're not using exogenous features you don't need to provide futr_df.

@Cuvi3
Copy link
Author

Cuvi3 commented May 9, 2024

Are you providing the target as a future exogenous feature? If you're not using exogenous features you don't need to provide .futr_df

Yes,I think I should take the target as a future exogenous feature.In fact, I learned the usage of PatchTST from the official documentation, and the futr_df is provided in the official documentation.

@jmoralez
Copy link
Member

jmoralez commented May 9, 2024

Yes,I think I should take the target as a future exogenous feature

So you want to predict y using y as a feature?

@Cuvi3
Copy link
Author

Cuvi3 commented May 13, 2024

So you want to predict y using y as a feature?

Yes, I think so, because that's how it seems to be used in the official documentation. And I do want to predict y, then visualize the results of the prediction, just like in the example.

@jmoralez
Copy link
Member

Which documentation are you referring to? I'm pretty sure that just nf.predict() would work for your case.

@tibeler
Copy link

tibeler commented May 22, 2024

I RUN INTO IT TOO,complete disaster.

@tibeler
Copy link

tibeler commented May 22, 2024

i was using TFT,and i did not predict y by y ,and the error ocured. by the way what should i put at futr_df?

@Cuvi3
Copy link
Author

Cuvi3 commented May 22, 2024

Which documentation are you referring to? I'm pretty sure that just nf.predict() would work for your case.

It's in Nixtla's official documentation of PatchTST usage example,and the URL is https://nixtlaverse.nixtla.io/neuralforecast/models.patchtst.html#patchtst.

@jmoralez
Copy link
Member

That example is wrong, it's not using any exogenous features. Can you try just running nf.predict()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants