Create model weights based on ranking and apply to forecast data
Source:R/propose-weights.R
propose_weights.Rd
This function creates weights based on a ranked dataframe of models. It takes in either a path containing csv files, a list of csv files, or a dataframe with a column named "model_name" containing the respective model names and applies the weights to each model's predictions. The output is a new csv file with the weighted ensemble forecast and a dataframe of the calculated weights.
Usage
propose_weights(
forecast_data,
ingest = c("dataframe", "path", "list"),
rank_df,
rankCol = NULL,
drop = NULL,
team = "TeamName",
mod_name = "my_ensemble"
)
Arguments
- forecast_data
A dataframe, path to directory with csv files, or list of csv files containing the forecasts to be weighted.
- ingest
A character vector that determines whether the forecast_data parameter represents a dataframe ("dataframe"), a directory path as a string (e.g. "./forecast_data") of csv files containing forecast data ("path"), or a list of strings each representing the path to a csv file ("list").
- rank_df
A dataframe containing columns for each model's name and its rank.
- rankCol
The name of the column in the
rank_df
dataframe that contains the ranking information.- drop
An integer indicating how many models at the bottom of the ranking should be excluded from the analysis.
- team
A string representing the name of the team generating the forecast data.
- mod_name
A string representing the name of the weighted ensemble model.