philipperemy / n-beats

Keras/Pytorch implementation of N-BEATS: Neural basis expansion analysis for interpretable time series forecasting.
MIT License
855 stars 163 forks source link

Can we use a pandas dataframe with multiple dependent variables? #60

Closed thepraveen19 closed 2 years ago

thepraveen19 commented 2 years ago

I want to analyse the stock market data which has multiple parameters as input variables and one target variable. Is it possible to use NBEATS ??

philipperemy commented 2 years ago

https://github.com/philipperemy/n-beats/issues/60

@thepraveen19 the original paper of NBeats only considered 1-D time series and the target was X[t+1] when the context was X[t], X[t-1]..., X[t-N].

Two points:

So it's definitely possible to use a Pandas DataFrame with multiple depend variables.

A simple way to do that:

https://github.com/philipperemy/n-beats/blob/master/examples/pandas_example.py

thepraveen19 commented 2 years ago

Hi,

Thank you for the revert. A quick question, you mentioned that we can forget the time dimension. I don't understand how it works from the statistical standpoint. Is there a document or something that can help me understand how it functions?

Your help is much appreciated.

Thank you

Regards, Praveen

On Fri, 14 Jan 2022, 08:23 Philippe Rémy, @.***> wrote:

60 https://github.com/philipperemy/n-beats/issues/60

@thepraveen19 https://github.com/thepraveen19 the original paper of NBeats only considered 1-D time series and the target was X[t+1] when the context was X[t], X[t-1]..., X[t-N].

Two points:

  • But in practice, you don't need to have both X in the predictors and the target.
  • Also NBeats is a RNN but you technically don't need to use it as an RNN as well (you can forget the time dimension)

So it's definitely possible to use a Pandas DataFrame with multiple depend variables.

A simple way to do that:

https://github.com/philipperemy/n-beats/blob/master/examples/pandas_example.py

— Reply to this email directly, view it on GitHub https://github.com/philipperemy/n-beats/issues/60#issuecomment-1012906978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKESZO4TMAZG2HQEQ57KMCDUV7MORANCNFSM5LADMNOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

philipperemy commented 2 years ago

Hi,

I assumed that all the rows in the dataset are independent are permutable (meaning the order of your dataFrame does not matter). But if your dataset is indexed by time, yes we can take the time dimension into account. Let me work out another example for you.

philipperemy commented 2 years ago

Okay I updated the code here: https://github.com/philipperemy/n-beats/blob/master/examples/pandas_example.py

Including time.

thepraveen19 commented 2 years ago

That is incredibly helpful...

I'm very grateful...

Thank you so much again ...

Regards, Praveen

On Fri, 14 Jan 2022, 08:58 Philippe Rémy, @.***> wrote:

Okay I updated the code here: https://github.com/philipperemy/n-beats/blob/master/examples/pandas_example.py

Including time.

— Reply to this email directly, view it on GitHub https://github.com/philipperemy/n-beats/issues/60#issuecomment-1012928940, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKESZO5JKM2CY7L7YKO7YDDUV7QR3ANCNFSM5LADMNOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

philipperemy commented 2 years ago

Welcome!

thepraveen19 commented 2 years ago

Hi,

It gives an error:


TypeError Traceback (most recent call last)

in () 5 output_dim=1, 6 nb_blocks_per_stack=1, ----> 7 backcast_length=timesteps) 8 TypeError: __init__() got an unexpected keyword argument 'output_dim' I checked the documentation, 'output_dim' is not built in. How can I Solve this? Screenshot 2022-01-15 at 02 04 55
philipperemy commented 2 years ago

@thepraveen19 right I need to push the latest version. Hang on.

philipperemy commented 2 years ago

Run this and try again.

pip install nbeats-keras --upgrade
thepraveen19 commented 2 years ago

Awesome! You are amaziiiiiing..... I went through your website( sky sense)... you are doing great work.... Cheers!

philipperemy commented 2 years ago

Awesome! Thanks for the feedback :)