Package: shapr 1.0.0.9000

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 methods 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:Martin Jullum [cre, aut], Lars Henry Berge Olsen [aut], Annabelle Redelmeier [aut], Jon Lachmann [aut], Nikolai Sellereite [aut], Anders Løland [ctb], Jens Christian Wahl [ctb], Camilla Lingjærde [ctb], Norsk Regnesentral [cph, fnd]

shapr_1.0.0.9000.tar.gz
shapr_1.0.0.9000.zip(r-4.5)shapr_1.0.0.9000.zip(r-4.4)shapr_1.0.0.9000.zip(r-4.3)
shapr_1.0.0.9000.tgz(r-4.4-x86_64)shapr_1.0.0.9000.tgz(r-4.4-arm64)shapr_1.0.0.9000.tgz(r-4.3-x86_64)shapr_1.0.0.9000.tgz(r-4.3-arm64)
shapr_1.0.0.9000.tar.gz(r-4.5-noble)shapr_1.0.0.9000.tar.gz(r-4.4-noble)
shapr_1.0.0.9000.tgz(r-4.4-emscripten)shapr_1.0.0.9000.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

10.61 score 147 stars 2 packages 211 scripts 1.4k downloads 56 exports 12 dependencies

Last updated 1 days agofrom:2a3d08807a. Checks:OK: 1 ERROR: 8. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 22 2024
R-4.5-win-x86_64ERRORNov 22 2024
R-4.5-linux-x86_64ERRORNov 22 2024
R-4.4-win-x86_64ERRORNov 22 2024
R-4.4-mac-x86_64ERRORNov 22 2024
R-4.4-mac-aarch64ERRORNov 22 2024
R-4.3-win-x86_64ERRORNov 22 2024
R-4.3-mac-x86_64ERRORNov 22 2024
R-4.3-mac-aarch64ERRORNov 22 2024

Exports:additional_regression_setupaicc_full_single_cppappend_vS_listcheck_convergencecli_compute_vScli_itercli_startupcoalition_matrix_cppcompute_estimatescompute_shapley_newcompute_timecompute_vScorrection_matrix_cppcreate_coalition_tableexplainexplain_forecastfinalize_explanationfinalize_explanation_forecastget_cov_matget_data_specsget_extra_est_args_defaultget_iterative_args_defaultget_model_specsget_mu_vecget_output_args_defaultget_supported_approacheshat_matrix_cppmahalanobis_distance_cppobservation_impute_cppplot_MSEv_eval_critplot_SV_several_approachespredict_modelprepare_dataprepare_data_causalprepare_data_copula_cppprepare_data_copula_cpp_causprepare_data_gaussian_cppprepare_data_gaussian_cpp_causprepare_next_iterationprint_iterregression.train_modelrss_cppsave_resultssetupsetup_approachsetup_computationshapley_setuptesting_cleanupvaeac_get_evaluation_criteriavaeac_get_extra_para_defaultvaeac_plot_eval_critvaeac_plot_imputed_ggpairsvaeac_train_modelvaeac_train_model_continueweight_matrixweight_matrix_cpp

Dependencies:codetoolsdata.tabledigestfuturefuture.applyglobalslatticelistenvMatrixparallellyRcppRcppArmadillo

shapr: Explaining individual machine learning predictions with Shapley values

Rendered fromunderstanding_shapr.Rmdusingknitr::rmarkdownon Nov 22 2024.

Last update: 2024-11-22
Started: 2019-09-26

Asymmetric and causal Shapley value explanations

Rendered fromunderstanding_shapr_asymmetric_causal.Rmdusingknitr::rmarkdownon Nov 22 2024.

Last update: 2024-11-22
Started: 2024-10-23

Shapley value explanations using the regression paradigm

Rendered fromunderstanding_shapr_regression.Rmdusingknitr::rmarkdownon Nov 22 2024.

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

More details and advanced usage of the vaeac approach

Rendered fromunderstanding_shapr_vaeac.Rmdusingknitr::rmarkdownon Nov 22 2024.

Last update: 2024-11-22
Started: 2024-03-05

Readme and manuals

Help Manual

Help pageTopics
Define coalitions, and fetch additional information about each unique coalitioncreate_coalition_table
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
Gathers the final output to create the explanation objectfinalize_explanation
Computes the Shapley values given 'v(S)'finalize_explanation_forecast
get_cov_matget_cov_mat
Set up data for explain_forecastget_data_forecast
Gets the default values for the extra estimation argumentsget_extra_est_args_default
Function to specify arguments of the iterative estimation procedureget_iterative_args_default
get_mu_vecget_mu_vec
Gets the default values for the output argumentsget_output_args_default
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