rescale_predictions: Rescale predictions to original scale.

rescale_predictionsR Documentation

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)

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.

Value

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

Examples


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)


ubair documentation built on April 12, 2025, 2:12 a.m.