def accumulate(self, groundTruth, prediction, accumulatedError, historyBuffer, result):
Updates the accumulated error given the prediction and the
ground truth.

:param groundTruth: Actual value that is observed for the current timestep

:param prediction: Value predicted by the network for the given timestep

:param accumulatedError: The total accumulated score from the previous
       predictions (possibly over some finite window)

:param historyBuffer: A buffer of the last <self.window> ground truth values
       that have been observed.

       If historyBuffer = None,  it means that no history is being kept.

:param result: An ModelResult class (see opf_utils.py), used for advanced
       metric calculation (e.g., MetricNegativeLogLikelihood)

:returns: The new accumulated error. That is:

    .. code-block:: python

       self.accumulatedError = self.accumulate(
         groundTruth, predictions, accumulatedError
       )

    ``historyBuffer`` should also be updated in this method.
    ``self.spec.params["window"]`` indicates the maximum size of the window.