Learn R Programming

ubair (version 1.1.1)

rescale_predictions: Rescale predictions to original scale.

Description

This function rescales the predicted values (prediction, prediction_lower, prediction_upper). The scaling is reversed using the means and standard deviations that were saved from the training data. It is the inverse function to scale_data() and should be used only in combination.

Usage

rescale_predictions(scale_result, dt_predictions)

Value

A data frame with the predictions and numeric columns rescaled back to their original scale.

Arguments

scale_result

A list object returned by scale_data(), containing the means and standard deviations used for scaling.

dt_predictions

A data frame containing the predictions, including columns prediction, prediction_lower, prediction_upper.

Examples

Run this code
# \donttest{
data(mock_env_data)
scale_res <- scale_data(
  train_data = mock_env_data[1:80, ],
  apply_data = mock_env_data[81:100, ]
)
params <- load_params()
res <- run_lightgbm(
  train = scale_res$train, test = scale_res$apply,
  params$lightgbm, alpha = 0.9, calc_shaps = FALSE
)
dt_predictions <- res$dt_predictions
rescaled_predictions <- rescale_predictions(scale_res, dt_predictions)
# }

Run the code above in your browser using DataLab