awslabs / gluonts

Probabilistic time series modeling in Python
https://ts.gluon.ai
Apache License 2.0
4.64k stars 755 forks source link

DeepARE loss becoming negative #687

Closed consose closed 4 years ago

consose commented 4 years ago

Dear Sir/Madame, I'm new to gluonts and probabilistic forecasting. I'm training a DeepARE model on a daily time-series with the following parameters:

Number of Epochs=5 Learning Rate=0.01 Number of RNN layers=2 Number of RNN cells for each layer=40 Number of RNN cells for each layer=lstm

For the rest, I leave all the default values.

When I do the training, I obtain the loss decreasing passing from positive to negative values. How is it possible? This is how it looks like:

Start model training Epoch[0] Learning rate is 0.01 Number of parameters in DeepARTrainingNetwork: 26044 Epoch[0] Elapsed time 30.988 seconds Epoch[0] Evaluation metric 'epoch_loss'=0.188573 Epoch[1] Learning rate is 0.01 Epoch[1] Elapsed time 30.306 seconds Epoch[1] Evaluation metric 'epoch_loss'=-0.131554 Epoch[2] Learning rate is 0.01 Epoch[2] Elapsed time 30.330 seconds Epoch[2] Evaluation metric 'epoch_loss'=-0.273915 Epoch[3] Learning rate is 0.01 Epoch[3] Elapsed time 30.184 seconds Epoch[3] Evaluation metric 'epoch_loss'=-0.337020 Epoch[4] Learning rate is 0.01 Epoch[4] Elapsed time 30.069 seconds Epoch[4] Evaluation metric 'epoch_loss'=-0.398353 Loading parameters from best epoch (4) Final loss: -0.39835323095321656 (occurred at epoch 4) End model training

Sorry for the maybe stupid question, but I don't understand why the loss is becoming negative. What is the loss function that the algorithm is minimizing during training?

Please let me know. Best, Sergio

geoalgo commented 4 years ago

The loss being minimized is the negative likelihood of the model distribution (student-t by default) it can be negative in some cases, nothing wrong with that.

consose commented 4 years ago

cheers!