Using online
in Production
This vignette explains the use of predict()
and
update()
. These are the two most important functions when
using profoc
in production. The predict()
method is used to combine new expert forecasts using the most recent
combination weights. This is useful if we combine new expert forecasts
with the most recent combination weights, but new observations have yet
to be realized. At a later point, update()
can be used to
update the combination weights by evaluating the realized observations.
We assume that you followed the vignette("profoc")
already.
We will reuse the data and the model from there.
Combining new expert predictions
First, we create new expert predictions:
new_experts <- experts[T, , , drop = FALSE]
The default behavior of predict()
updates the
combination
object. So, it can later be used to update the
combination weights as realized values emerge. That is,
predict()
expands combination$predictions
and
returns the updated combination
.
dim(combination$predictions)
#> [1] 32 1 99
# Predict will expand combination$predictions
combination <- predict(combination,
new_experts = new_experts
)
dim(combination$predictions)
#> [1] 33 1 99
If you are only interested in the predictions, you can set
update_model = FALSE
. In this case, predict()
solely returns the predictions:
Updating the model weights
As new realizations emerge, we can update the combination weights.
This is done by update()
. That is, update()
expands combination$weights
and returns the updated
combination
.
Summary on predict()
and update()
As seen above, predict()
and update()
are
closely related and usually called sequentially. In an only setting, we
want to calculate the forecast (the combination) as soon as new expert
predictions emerge. For that, we can use predict()
. Later,
as new observations are realized, we can update()
the
combination weights.
We designed to also work in non-standard scenarios. So if, for
example, experts provide multi-step-ahead predictions, we can use
predict()
to combine all of them using the most recent
combination weights. Afterward, one or multiple update()
calls can be used to update the combination weights as new observations
are realized. If we want to predict()
and
update()
simultaneously, we can do this. We can pass the
new expert predictions and observations to predict()
. This
will update the combination weights and predictions with only one call
to predict()
.