* using log directory ‘/data/blackswan/ripley/R/packages/tests-devel/shapr.Rcheck’ * using R Under development (unstable) (2025-12-02 r89085) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) GNU Fortran (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3) * running under: Fedora Linux 40 (Workstation Edition) * using session charset: UTF-8 * checking for file ‘shapr/DESCRIPTION’ ... OK * this is package ‘shapr’ version ‘1.0.6’ * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘shapr’ can be installed ... [91s/80s] OK * used C++ compiler: ‘g++ (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)’ * checking package directory ... OK * checking ‘build’ directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking whether startup messages can be suppressed ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [22s/22s] OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking line endings in C/C++/Fortran sources/headers ... OK * checking line endings in Makefiles ... OK * checking compilation flags in Makevars ... OK * checking for GNU extensions in Makefiles ... OK * checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK * checking use of PKG_*FLAGS in Makefiles ... OK * checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK * checking compilation flags used ... OK * checking compiled code ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK * checking examples ... OK * checking examples with --run-donttest ... [38s/44s] ERROR Running examples in ‘shapr-Ex.R’ failed The error most likely occurred in: > ### Name: plot_MSEv_eval_crit > ### Title: Plots of the MSEv Evaluation Criterion > ### Aliases: plot_MSEv_eval_crit > > ### ** Examples > > ## No test: > if (requireNamespace("xgboost", quietly = TRUE) && requireNamespace("ggplot2", quietly = TRUE)) { + # Get the data + data("airquality") + data <- data.table::as.data.table(airquality) + data <- data[complete.cases(data), ] + + #' Define the features and the response + x_var <- c("Solar.R", "Wind", "Temp", "Month") + y_var <- "Ozone" + + # Split data into test and training data set + ind_x_explain <- 1:25 + x_train <- data[-ind_x_explain, ..x_var] + y_train <- data[-ind_x_explain, get(y_var)] + x_explain <- data[ind_x_explain, ..x_var] + + # Fitting a basic xgboost model to the training data + model <- xgboost::xgboost( + data = as.matrix(x_train), + label = y_train, + nround = 20, + verbose = FALSE + ) + + # Specifying the phi_0, i.e. the expected prediction without any features + phi0 <- mean(y_train) + + # Independence approach + explanation_independence <- explain( + model = model, + x_explain = x_explain, + x_train = x_train, + approach = "independence", + phi0 = phi0, + n_MC_samples = 1e2 + ) + + # Gaussian 1e1 approach + explanation_gaussian_1e1 <- explain( + model = model, + x_explain = x_explain, + x_train = x_train, + approach = "gaussian", + phi0 = phi0, + n_MC_samples = 1e1 + ) + + # Gaussian 1e2 approach + explanation_gaussian_1e2 <- explain( + model = model, + x_explain = x_explain, + x_train = x_train, + approach = "gaussian", + phi0 = phi0, + n_MC_samples = 1e2 + ) + + # ctree approach + explanation_ctree <- explain( + model = model, + x_explain = x_explain, + x_train = x_train, + approach = "ctree", + phi0 = phi0, + n_MC_samples = 1e2 + ) + + # Combined approach + explanation_combined <- explain( + model = model, + x_explain = x_explain, + x_train = x_train, + approach = c("gaussian", "independence", "ctree"), + phi0 = phi0, + n_MC_samples = 1e2 + ) + + # Create a list of explanations with names + explanation_list_named <- list( + "Ind." = explanation_independence, + "Gaus. 1e1" = explanation_gaussian_1e1, + "Gaus. 1e2" = explanation_gaussian_1e2, + "Ctree" = explanation_ctree, + "Combined" = explanation_combined + ) + + # Create the default MSEv plot where we average over both the coalitions and observations + # with approximate 95% confidence intervals + plot_MSEv_eval_crit(explanation_list_named, CI_level = 0.95, plot_type = "overall") + + # Can also create plots of the MSEv criterion averaged only over the coalitions or observations. + MSEv_figures <- plot_MSEv_eval_crit(explanation_list_named, + CI_level = 0.95, + plot_type = c("overall", "comb", "explicand") + ) + MSEv_figures$MSEv_bar + MSEv_figures$MSEv_coalition_bar + MSEv_figures$MSEv_explicand_bar + + # When there are many coalitions or observations, then it can be easier to look at line plots + MSEv_figures$MSEv_coalition_line_point + MSEv_figures$MSEv_explicand_line_point + + # We can specify which observations or coalitions to plot + plot_MSEv_eval_crit(explanation_list_named, + plot_type = "explicand", + index_x_explain = c(1, 3:4, 6), + CI_level = 0.95 + )$MSEv_explicand_bar + plot_MSEv_eval_crit(explanation_list_named, + plot_type = "comb", + id_coalition = c(3, 4, 9, 13:15), + CI_level = 0.95 + )$MSEv_coalition_bar + + # We can alter the figures if other palette schemes or design is wanted + bar_text_n_decimals <- 1 + MSEv_figures$MSEv_bar + + ggplot2::scale_x_discrete(limits = rev(levels(MSEv_figures$MSEv_bar$data$Method))) + + ggplot2::coord_flip() + + ggplot2::scale_fill_discrete() + #' Default ggplot2 palette + ggplot2::theme_minimal() + #' This must be set before the other theme call + ggplot2::theme( + plot.title = ggplot2::element_text(size = 10), + legend.position = "bottom" + ) + + ggplot2::guides(fill = ggplot2::guide_legend(nrow = 1, ncol = 6)) + + ggplot2::geom_text( + ggplot2::aes(label = sprintf( + paste("%.", sprintf("%d", bar_text_n_decimals), "f", sep = ""), + round(MSEv, bar_text_n_decimals) + )), + vjust = -1.1, # This value must be altered based on the plot dimension + hjust = 1.1, # This value must be altered based on the plot dimension + color = "black", + position = ggplot2::position_dodge(0.9), + size = 5 + ) + } Warning in throw_err_or_depr_msg("Passed unrecognized parameters: ", paste(head(names_unrecognized), : Passed unrecognized parameters: verbose. This warning will become an error in a future version. Warning in throw_err_or_depr_msg("Parameter '", match_old, "' has been renamed to '", : Parameter 'data' has been renamed to 'x'. This warning will become an error in a future version. Warning in throw_err_or_depr_msg("Parameter '", match_old, "' has been renamed to '", : Parameter 'label' has been renamed to 'y'. This warning will become an error in a future version. ── Starting `shapr::explain()` at 2025-12-03 11:15:11 ────────────────────────── ℹ You passed a model to `shapr::explain()` which is not natively supported, and did not supply a `get_model_specs` function to `shapr::explain()`. Consistency checks between model and data are therefore disabled. ℹ `max_n_coalitions` is `NULL` or larger than `2^n_features = 16`, and is therefore set to `2^n_features = 16`. Error in `get_predict_model()`: ! You passed a model to `shapr::explain()` that is not natively supported and did not supply a 'predict_model' function to `shapr::explain()`. See the documentation of `shapr::explain()` or the `vignette(shapr::general_usage)` vignette for more information on how to run shapr with custom models. Backtrace: ▆ 1. └─shapr::explain(...) 2. └─shapr:::get_predict_model(predict_model = predict_model, model = model) 3. └─cli::cli_abort(...) 4. └─rlang::abort(...) Execution halted * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘testthat.R’ [276s/282s] [276s/282s] OK * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... OK * checking re-building of vignette outputs ... [18s/18s] OK * checking PDF version of manual ... [11s/11s] OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * checking for new files in some other directories ... OK * DONE Status: 1 ERROR See ‘/data/blackswan/ripley/R/packages/tests-devel/shapr.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 8:20.43, 470.58 + 27.80