Skip to contents

Check the results of your holdout test to validate your prediction model.

Usage

holdout_test(cbs, predictions)

Arguments

cbs

Customer by statistics dataframe used as input for the fit_customer_model().

predictions

Customer level predictions made by fit_customer_model().

Examples


config <- appraise_configure(sample = TRUE,
                             cpa = c(25, 50, 75, 100, 125, 150, 200),
                             cm =  c(.2, .3, .432, .5),
                             holdout_date = as.Date("2019-07-16"),
                             currency = '$',
                             n_forecast =  5,
                             aws_bucket = 'monorepo-data/med',
                             google_drive_id = '1laRarNAPgZlBGkztQgHAYgs7Xy2l0le9')


full_cbs <- 
   elog_to_stan(elog_validated$elog,
                config,
                items_and_returns_validated$items_and_returns)
#> Note: sample is set to TRUE, but your sample size (1e+05) is larger than the input data. Defaulting to full dataset.
#> Elog conversion finished. Ready to start modeling.
#> 

customer_level_predictions <- fit_customer_model(full_cbs, config)
#> Loading STAN model...
#> error: PCH file uses an older PCH format that is no longer supported
#> Warning: CmdStan's precompiled header (PCH) files may need to be rebuilt.
#> If your model failed to compile please run rebuild_cmdstan().
#> If the issue persists please open a bug report.
#> 1 error generated.
#> make: *** [/var/folders/b5/cdxlqz9j3kxb1hxl70pw25100000gn/T/RtmpKWd2ib/model-bf2f47c0ce82] Error 1
#> Error: An error occured during compilation! See the message above for more information.
automated_results <- extract_customer_model_results(customer_level_predictions, full_cbs, config)
#> Error in fit$output_files(): attempt to apply non-function

res <- holdout_test(cbs = full_cbs$cbs, predictions = automated_results$customer_level_data)
#> Error: object 'automated_results' not found