R/zzz.R

Defines functions .onLoad

.onLoad <- function(libname = find.package("shapr"), pkgname = "shapr") {
  # CRAN Note avoidance 1
  # (as per https://stackoverflow.com/questions/77323811/r-package-to-cran-had-cpu-time-5-times-elapsed-time)
  # CRAN OMP THREAD LIMIT
  Sys.setenv("OMP_THREAD_LIMIT" = 1)

  # CRAN Note avoidance 2:
  utils::globalVariables(
    c(
      ".",
      ".N",
      ".I",
      ".GRP",
      ".SD",
      "joint_prob",
      "N",
      "id_all",
      "id",
      "id_coalition",
      "w",
      "id_all",
      "joint_prob",
      "cond_prob",
      "marg_prob",
      "n_features",
      "p_hat",
      "k",
      "model_class",
      "rn",
      "get_model_specs",
      "native_get_model_specs",
      "from",
      "predict_model",
      "native_predict_model",
      "native",
      "rank_waterfall",
      "end",
      "start",
      "phi_significant",
      "y_text",
      "hjust_text",
      "arrow_color",
      "sign",
      "y_text_bar",
      "hjust_text_bar",
      "feature_value",
      "positive",
      "feature_value_scaled",
      "text_color_bar",
      "unique_label",
      "pred_label",
      "pred_x",
      "element_rect",
      "element_line",
      "guide_colourbar",
      "x_start",
      "x_end",
      "y_start",
      "y_end",
      "phi0_x",
      "phi0_label",
      "phi",
      "header",
      "variable",
      "pred",
      "description",
      "min",
      "max",
      "features",
      "shapley_weight",
      "features_tmp",
      "sample_frequence",
      "is_duplicate",
      "groups",
      "n_groups",
      "groups_tmp",
      "approach",
      "n_leftover_first_batch",
      "n_S_per_approach",
      "n_batches_per_approach",
      "randomorder",
      "batch",
      "type",
      "feature_value_factor",
      "horizon_id_coalition",
      "tmp_features",
      "Method",
      "MSEv",
      "MSEv_sd",
      "error",
      ".header",
      ".id",
      ".pred",
      ".only_these_features_wo_none",
      ".only_these_columns",
      "Epoch",
      ".description",
      ".phi",
      ".method",
      "Value",
      "Criterion",
      "checkpoint",
      "..col_cont_names",
      "n_train",
      "one_hot_max_sizes",
      "train_dataloader",
      "vaeac_model_best_listmodel",
      "vaeac_save_file_names",
      "val_dataloader",
      "x_train",
      "x_train_preprocessed",
      "x_train_torch",
      "self",
      "..current_comb",
      "..regression.response_var",
      "sample_freq",
      "features_dup",
      "features_dup_tmp",
      "maxval",
      "minval",
      "req_samples",
      "explain_id",
      "id_coalition_new",
      "features_str",
      "boot_id",
      "iter",
      "total",
      "coalitions",
      "coalition_size",
      "initial_n_coalitions",
      "max_n_coalitions",
      "fixed_n_coalitions_per_iter",
      "n_coal_next_iter_factor_vec",
      "n_boot_samps",
      "compute_sd",
      "min_n_batches",
      "max_batch_size",
      "saving_path",
      "coalitions_str",
      "cond",
      "tmp_coalitions",
      "max_iter",
      "convergence_tol",
      "conv_measure",
      "verbose",
      "MSEv_uniform_comb_weights",
      "keep_samp_for_vS",
      "S_original_names_with_id",
      "Sbar_features",
      "Sbar_now_names",
      "cond_cols_with_id",
      "dt_factor_names",
      "feature_conditioned",
      "feature_conditioned_id",
      "feature_names",
      "relevant_features",
      "i.N",
      "prob",
      "shapley_weight_norm",
      "L",
      "N_S",
      "paired_shap_sampling",
      "semi_deterministic_sampling",
      "n_coal_max",
      "vS_batching_method"
    )
  )


  invisible()
}

Try the shapr package in your browser

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

shapr documentation built on June 8, 2025, 10:22 a.m.