Performs sequential predictions and updates of a mixture object based on new observations and expert advice.
# S3 method for mixture
predict(
object,
newexperts = NULL,
newY = NULL,
awake = NULL,
online = TRUE,
type = c("model", "response", "weights", "all"),
use_cpp = getOption("opera_use_cpp", default = FALSE),
quiet = TRUE,
...
)
Object of class inheriting from 'mixture'
An optional matrix in which to look for expert advice with which predict. If omitted, the past predictions of the object are returned and the object is not updated.
An optional matrix with d columns (or vector if \(d=1\)) of observations to be predicted. If provided, it
should have the same number of rows as the number of rows of newexperts
.
If omitted, the object (i.e, the aggregation rule) is not updated.
An optional array specifying the
activation coefficients of the experts. It must have the same dimension as experts. Its entries lie in [0,1]
.
Possible if some experts are specialists and do not always form and suggest
prediction. If the expert number k
at instance t
does not
form any prediction of observation Y_t
, we can put
awake[t,k]=0
so that the mixture does not consider expert k
in
the mixture to predict Y_t
.
A boolean determining if the observations in newY are predicted sequentially (by updating the object step by step) or not. If FALSE, the observations are predicting using the object (without using any past information in newY). If TRUE, newY and newexperts should not be null.
Type of prediction. It can be
return the updated version of object (using newY and newexperts).
return the forecasts. If type is 'model', forecasts can also be obtained from the last values of object$prediction.
return the weights assigned to the expert advice to produce the forecasts. If type is 'model', forecasts can also be obtained from the last rows of object$weights.
return a list containing 'model', 'response', and 'weights'.
boolean
. Whether or not to use cpp optimization to fasten the computations. This option is not yet compatible
with the use of custom loss function.
boolean
. Whether or not to display progress bars.
further arguments are ignored
predict.mixture
produces a matrix of predictions
(type = 'response'), an updated object (type = 'model'), or a matrix of
weights (type = 'weights').