View source: R/data_preprocessing.R
retrend_predictions | R Documentation |
Takes a dataframe of predictions as returned by any of
the 'run_model' functions and restores a trend which was previously
removed via detrend()
. This is necessary for the predictions
and the true values to have the same units. The function is basically
the inverse function to detrend()
and should only be used in
combination with it.
retrend_predictions(dt_predictions, trend, log_transform = FALSE)
dt_predictions |
Dataframe of predictions with columns |
trend |
lm object generated by |
log_transform |
Returns values to solution space, if they have been
log transformed during detrending. Use only in combination with |
Retrended dataframe with same structure as dt_predictions
which is returned by any of the run_model() functions.
data(mock_env_data)
split_data <- list(
train = mock_env_data[1:80, ],
apply = mock_env_data[81:100, ]
)
params <- load_params()
detrended_list <- detrend(split_data,
mode = "linear"
)
trend <- detrended_list$model
detrended_train <- detrended_list$train
detrended_apply <- detrended_list$apply
result <- run_lightgbm(
train = detrended_train,
test = detrended_apply,
model_params = params$lightgbm,
alpha = 0.9,
calc_shaps = FALSE
)
retrended_predictions <- retrend_predictions(result$dt_predictions, trend)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.