Multivariate Time Series Forecasting with LSTM using PyTorch and PyTorch Lightning (ML Tutorial)

preview_player
Показать описание

Build and train an LSTM Deep Neural Network for predicting Bitcoin price from multivariate Time Series data. We'll use PyTorch and PyTorch Lightning to train and evaluate our model.

⭐️ Tutorial Contents ⭐️

(00:00) Intro
(02:30) Create PyTorch dataset
(12:44) Build LSTM model
(27:58) Training setup
(31:45) Exploring the predictions
(44:34) Outro

#PyTorch #LSTM #TimeSeries #PyTorchLightning #Python
Рекомендации по теме
Комментарии
Автор

This is hands down the best tutorial for using pytorch for timeseries forecasting.

vardaanbajaj
Автор

why are you giving test_dataset in both val_dataloader and test_data loader? shouldn't they be separate datasets( like val_dataset and test_dataset)

friendlybot
Автор

Great tutorial, thank you!!! For those who have used this create_sequence function, be careful! There is data leakage, as sequence has target as a feature

tayjen
Автор

I'm just wondering how the prediction could be viable for an actual future prediction when (open, high, low, close and close__change) variables are also a part of the training. How would one be able to predict BTC price for the next 5 days for example not knowing what those variables in the next 5 days will be?
Would appreciate your response on this and thanks for this great tutorial.

miladmahdavi
Автор

Hi Vanelin. May I know how to do if I want to predict multiple time steps ahead instead of one step? Can you please show an example? thanks

cwumin
Автор

Is there note repo for the full code in this tutorial? Could not find it on your github or linked on your blog.

willbrenton
Автор

are you able to share the notebooks in these video series?

richardy
Автор

But when you unscale the predictions and the labels, the error increases accordingly? The accuracy is not as good as it was?

zahramovahedinia
Автор

Is a github repo available? the one listed does not seem to contain this project

MarcDeveaux
Автор

Tried following along but have come to a hard stop with an error: Can't get attribute 'BTCDataset' on <module '__main__' (built-in)>

This was trying to modify the notebook to run locally, which took a lot of work. Had to uninstall torch, and reinstall torch + cuda. Then tensorboard stopped loading as an extension, even using pip install tensorboard. I tried using .to(device) to put the class on the GPU but for whatever reason when I start trainer.fit() I get this error and am out of ideas. A shame - this seemed an excellent video otherwise

Aegilops
Автор

Nice video and thanks. I am running into an issue. Any thoughts on what could be going wrong?

1484 pl_module = self.lightning_module or pl_module
1485 if pl_module:
-> 1486 prev_fx_name = pl_module._current_fx_name
1487 pl_module._current_fx_name = hook_name
1488

AttributeError: 'BTCPricePredictor' object has no attribute '_current_fx_name'

sunderrajan
Автор

Nice tutorial on how to use Pytorch/Pytorch Lightning but your model is an example of a very common trap people fall into when trying to predict time series. It essentially learns to generate random values close to the last real value, and the divergence towards the end is probably due to a descaling error. To see if your model really predicts anything you should feed its own output as its next input during testing. It'll probably diverge within the next couple of steps.

Currently you are giving it a series, it predicts the next value, which is essentially just a random value close to the last one, and you give it the actual value to predict the next value again, and it is again just a random value close to the previous real value. When you continue doing this, model just spits out random values around he real value, one step at a time.

I don't know if I was able to explain myself clearly but let me know if you ahve any questions.

kuretaxyz
Автор

Getting this weird error:
Missing logger folder: lightning_logs/btc-price
...
TypeError: setup() got an unexpected keyword argument 'stage'

Manually created the folder lightning_logs but problem still persists. Solved it by installing the old version of lightning, version 1.2.5.

karlbooklover
Автор

Thank you for sharing. Seem like there is an error at 33:00 (MisconfigurationException: ModelCheckpoint(monitor='val_loss')), anybody knows how to solve this?

hiutuanting
Автор

Why is the val_loss value so high when replicating the code exactly as you've done?

ai_h
Автор

I dont understand the predictions step. Ive tried it and it doesn't work with my dataset. All numbers are weirdly

brysab
Автор

I've copied your code, but when I execute trainer.fit my google colab instance crashes every time. I ensured the the GPU runtime is selected. Anyone have any tips on how to fix this?

Ridgid
Автор

Yes! I have been waiting for a video tacking exactly this problem

DuduHarar
Автор

thanks for your effort, it was a nice tutorial . I just have a question, if we want to design similar LSTM model, but for a time series which has multiple variables as y, not only single output, like have a positions on the three coordinate system x, y, z and want to do predcition for next position, how can i do so ? this tutorial explain it for only one variable for example x .

alaaal-shubbak
Автор

for the BTCDataset shouldnt the length be len(self.sequences) not len(this.sequence)? - the prior worked for me...

darraghcaffrey