Add model prediction to returnPrediction S3 object

add_model_prediction(
  return_prediction,
  model_function,
  config,
  new_predictions
)

Arguments

return_prediction

Add model prediction to this object

model_function

Name of the prediction (model) function

config

Configuration for the model

new_predictions

Tibble with stock_id, date, and prediction columns

Value

returnPrediction S3 object with added model prediction

Examples

if (FALSE) {
# Assuming 'return_prediction' has been initialized and contains actual returns
# Sample new prediction data
new_predictions <- tibble::tibble(
  stock_id = 1:100,
  date = seq.Date(Sys.Date(), by = "day", length.out = 100),
  prediction = runif(100)  # Example prediction values
  )
# Model function and config for demonstration
model_function <- "xgb_pred"  # Placeholder for your model function
config <- list(max_depth = 4, eta = 0.1)  # Example configuration
# Adding the new model predictions
rp <- add_model_prediction(rp, model_function, config, new_predictions)
print(rp$predictions)
print(rp$errors)
print(rp$models)
}