I was going through the demonstration on learning how to learn with quantum neural networks. In the training routine, the program runs through 5 epochs giving out the following output:
Epoch 1
> Graph 1/20 - Loss: -1.6641689538955688
> Graph 6/20 - Loss: -1.4186843633651733
> Graph 11/20 - Loss: -1.3757232427597046
> Graph 16/20 - Loss: -1.294339656829834
>> Mean Loss during epoch: -1.7352586269378663
Epoch 2
> Graph 1/20 - Loss: -2.119091749191284
> Graph 6/20 - Loss: -1.4789190292358398
> Graph 11/20 - Loss: -1.3779840469360352
> Graph 16/20 - Loss: -1.2963457107543945
>> Mean Loss during epoch: -1.8252217948436738
Epoch 3
> Graph 1/20 - Loss: -2.1322619915008545
> Graph 6/20 - Loss: -1.459418535232544
> Graph 11/20 - Loss: -1.390620470046997
> Graph 16/20 - Loss: -1.3165746927261353
>> Mean Loss during epoch: -1.8328069806098939
Epoch 4
> Graph 1/20 - Loss: -2.1432175636291504
> Graph 6/20 - Loss: -1.476362943649292
> Graph 11/20 - Loss: -1.3938289880752563
> Graph 16/20 - Loss: -1.3140206336975098
>> Mean Loss during epoch: -1.8369774043560028
Epoch 5
> Graph 1/20 - Loss: -2.1429405212402344
> Graph 6/20 - Loss: -1.477513074874878
> Graph 11/20 - Loss: -1.3909202814102173
> Graph 16/20 - Loss: -1.315887689590454
>> Mean Loss during epoch: -1.8371947884559632
I understand that the loss reduces for each graph as we run across epochs and that validates the model’s performance. But shouldn’t there be a reduction in loss within an epoch as well ? Or at least within last 2-3 epochs?
In the first epoch, when the model runs through all the 20 graphs and updates its parameters after each graph in graph_cost_list
, it is essentially learning and fitting from the previous graphs. Thus, we expect the loss to reduce within an epoch as well right? Please let me know what I might be missing here. Thank you !