This function trains a random forest model (ranger) on the specified training dataset and makes predictions on the test dataset in a counterfactual scenario. The model uses meteorological variables and temporal features.
run_rf(train, test, model_params, alpha, calc_shaps)List with data frame of predictions and model
Dataframe of train data as returned by the split_data_counterfactual()
function.
Dataframe of test data as returned by the split_data_counterfactual()
function.
list of hyperparameters to use in ranger call. See ranger:ranger() for options.
Confidence level of the prediction interval between 0 and 1.
Boolean value. If TRUE, calculate SHAP values for the
method used and format them so they can be visualised with shapviz:sv_importance() and
shapviz:sv_dependence().
The SHAP values are generated for a subset (or all, depending on the size of the dataset) of the
test data.
Note: Runs the random forest model for individualised use with own data pipeline.
Otherwise use run_counterfactual() to call this function.