jinglescode / time-series-forecasting-pytorch

Acquiring data from Alpha Vantage and predicting stock prices with PyTorch's LSTM
https://www.alphavantage.co/academy/#lstm-for-finance
Apache License 2.0
250 stars 95 forks source link

MSEloss by default uses 'mean' as reduction method #13

Open akiori opened 2 years ago

akiori commented 2 years ago

MSEloss by default uses 'mean' as reduction method, so I think epoch_loss += (loss.detach().item() / batchsize) is incorrect

Alex-177 commented 1 year ago

I came in to write the same thing. Besides, now the loss is accumulating on every butch. More precisely, the loss / batchsize value is accumulated. It seems to me more logical to output the loss value on the last batch of training.