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
203 stars 84 forks source link

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

Open akiori opened 1 year ago

akiori commented 1 year 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.