Package: shapr 0.2.3.9200

Martin Jullum

shapr: Prediction Explanation with Dependence-Aware Shapley Values

Complex machine learning models are often hard to interpret. However, in many situations it is crucial to understand and explain why a model made a specific prediction. Shapley values is the only method for such prediction explanation framework with a solid theoretical foundation. Previously known methods for estimating the Shapley values do, however, assume feature independence. This package implements the method described in Aas, Jullum and Løland (2019) <arxiv:1903.10464>, which accounts for any feature dependence, and thereby produces more accurate estimates of the true Shapley values. An accompanying Python wrapper (shaprpy) is available on GitHub.

Authors:Nikolai Sellereite [aut], Martin Jullum [cre, aut], Lars Henry Berge Olsen [aut], Annabelle Redelmeier [aut], Jon Lachmann [aut], Anders Løland [ctb], Jens Christian Wahl [ctb], Camilla Lingjærde [ctb], Norsk Regnesentral [cph, fnd]

shapr_0.2.3.9200.tar.gz
shapr_0.2.3.9200.zip(r-4.5)shapr_0.2.3.9200.zip(r-4.4)shapr_0.2.3.9200.zip(r-4.3)
shapr_0.2.3.9200.tgz(r-4.4-x86_64)shapr_0.2.3.9200.tgz(r-4.4-arm64)shapr_0.2.3.9200.tgz(r-4.3-x86_64)shapr_0.2.3.9200.tgz(r-4.3-arm64)
shapr_0.2.3.9200.tar.gz(r-4.5-noble)shapr_0.2.3.9200.tar.gz(r-4.4-noble)
shapr_0.2.3.9200.tgz(r-4.4-emscripten)shapr_0.2.3.9200.tgz(r-4.3-emscripten)
shapr.pdf |shapr.html
shapr/json (API)
NEWS

# Install 'shapr' in R:
install.packages('shapr', repos = c('https://norskregnesentral.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/norskregnesentral/shapr/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library

On CRAN:

explainable-aiexplainable-mlrcpprcpparmadilloshapley

35 exports 140 stars 4.93 score 12 dependencies 1 dependents 139 scripts 1.1k downloads

Last updated 5 months agofrom:ddd32c7c92. Checks:OK: 1 ERROR: 8. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 13 2024
R-4.5-win-x86_64ERRORSep 13 2024
R-4.5-linux-x86_64ERRORSep 13 2024
R-4.4-win-x86_64ERRORSep 13 2024
R-4.4-mac-x86_64ERRORSep 13 2024
R-4.4-mac-aarch64ERRORSep 13 2024
R-4.3-win-x86_64ERRORSep 13 2024
R-4.3-mac-x86_64ERRORSep 13 2024
R-4.3-mac-aarch64ERRORSep 13 2024

Exports:aicc_full_single_cppcompute_shapley_newcompute_vScorrection_matrix_cppexplainexplain_forecastfeature_combinationsfeature_matrix_cppfinalize_explanationget_cov_matget_data_specsget_model_specsget_mu_vecget_supported_approacheshat_matrix_cppmahalanobis_distance_cppobservation_impute_cppplot_MSEv_eval_critplot_SV_several_approachespredict_modelprepare_dataprepare_data_copula_cppprepare_data_gaussian_cppregression.train_modelrss_cppsetupsetup_approachsetup_computationvaeac_get_evaluation_criteriavaeac_get_extra_para_defaultvaeac_plot_eval_critvaeac_plot_imputed_ggpairsvaeac_train_modelvaeac_train_model_continueweight_matrix_cpp

Dependencies:codetoolsdata.tabledigestfuturefuture.applyglobalslatticelistenvMatrixparallellyRcppRcppArmadillo

shapr: Explaining individual machine learning predictions with Shapley values

Rendered fromunderstanding_shapr.Rmdusingknitr::rmarkdownon Sep 13 2024.

Last update: 2024-04-17
Started: 2019-09-26

Shapley value explanations using the regression paradigm

Rendered fromunderstanding_shapr_regression.Rmdusingknitr::rmarkdownon Sep 13 2024.

Last update: 2024-04-17
Started: 2024-04-17

More details and advanced usage of the vaeac approach

Rendered fromunderstanding_shapr_vaeac.Rmdusingknitr::rmarkdownon Sep 13 2024.

Last update: 2024-04-18
Started: 2024-03-05

Readme and manuals

Help Manual

Help pageTopics
Computes 'v(S)' for all features subsets 'S'.compute_vS
Explain the output of machine learning models with more accurately estimated Shapley valuesexplain
Explain a forecast from a time series model using Shapley values.explain_forecast
Documentation of the approach-specific parameters in 'explain()'explain_tripledot_docs
Define feature combinations, and fetch additional information about each unique combinationfeature_combinations
Computes the Shapley values given 'v(S)'finalize_explanation
get_cov_matget_cov_mat
Set up data for explain_forecastget_data_forecast
get_mu_vecget_mu_vec
Gets the implemented approachesget_supported_approaches
Lag a matrix of variables a specific number of lags for each variables.lag_data
Plots of the MSEv Evaluation Criterionplot_MSEv_eval_crit
Shapley value bar plots for several explanation objectsplot_SV_several_approaches
Plot of the Shapley value explanationsplot.shapr
Treat factors as numeric valuesprocess_factor_data
Set up exogenous regressors for explanation in a forecast model.reg_forecast_setup
Auxiliary function for the vaeac vignetterelease_questions
check_setupsetup
Set up the framework chosen approachsetup_approach setup_approach.categorical setup_approach.copula setup_approach.ctree setup_approach.empirical setup_approach.gaussian setup_approach.independence setup_approach.regression_separate setup_approach.regression_surrogate setup_approach.timeseries setup_approach.vaeac
Sets up everything for the Shapley values computation in 'explain()'setup_computation
Function to set up data loaders and save file namesvaeac_get_data_objects
Extract the Training VLB and Validation IWAE from a list of explanations objects using the vaeac approachvaeac_get_evaluation_criteria
Function to specify the extra parameters in the 'vaeac' modelvaeac_get_extra_para_default
Plot the training VLB and validation IWAE for 'vaeac' modelsvaeac_plot_eval_crit
Plot Pairwise Plots for Imputed and True Datavaeac_plot_imputed_ggpairs
Train the Vaeac Modelvaeac_train_model
Continue to Train the vaeac Modelvaeac_train_model_continue