R/shapviz-package.R

Defines functions .onLoad

#' @aliases shapviz-package
"_PACKAGE"

# Suppress R CMD check note
#' @importFrom xgboost xgb.train

globalVariables(c("from", "i", "id", "label", "to", "x", "shap", "SHAP",
                  "feature", "value", "color", "Var2", "Var3", "S", "ind", "values"))

.onLoad <- function(libname, pkgname) {
  op <- options()
  op.shapviz <- list(
    shapviz.viridis_args = list(begin = 0.25, end = 0.85, option = "inferno"),
    shapviz.format_shap = function(z) prettyNum(z, digits = 3, scientific = FALSE),
    shapviz.format_feat = function(z) prettyNum(z, digits = 3, scientific = FALSE)
  )
  toset <- !(names(op.shapviz) %in% names(op))
  if (any(toset)) {
    options(op.shapviz[toset])
  }
  invisible()
}

Try the shapviz package in your browser

Any scripts or data that you put into this service are public.

shapviz documentation built on May 29, 2024, 2 a.m.