Package: shapley 0.3

shapley: Weighted Mean SHAP for Feature Selection in ML Grid and Ensemble

This R package introduces Weighted Mean SHapley Additive exPlanations (WMSHAP), an innovative method for calculating SHAP values for a grid of fine-tuned base-learner machine learning models as well as stacked ensembles, a method not previously available due to the common reliance on single best-performing models. By integrating the weighted mean SHAP values from individual base-learners comprising the ensemble or individual base-learners in a tuning grid search, the package weights SHAP contributions according to each model's performance, assessed by multiple either R squared (for both regression and classification models). alternatively, this software also offers weighting SHAP values based on the area under the precision-recall curve (AUCPR), the area under the curve (AUC), and F2 measures for binary classifiers. It further extends this framework to implement weighted confidence intervals for weighted mean SHAP values, offering a more comprehensive and robust feature importance evaluation over a grid of machine learning models, instead of solely computing SHAP values for the best model. This methodology is particularly beneficial for addressing the severe class imbalance (class rarity) problem by providing a transparent, generalized measure of feature importance that mitigates the risk of reporting SHAP values for an overfitted or biased model and maintains robustness under severe class imbalance, where there is no universal criteria of identifying the absolute best model. Furthermore, the package implements hypothesis testing to ascertain the statistical significance of SHAP values for individual features, as well as comparative significance testing of SHAP contributions between features. Additionally, it tackles a critical gap in feature selection literature by presenting criteria for the automatic feature selection of the most important features across a grid of models or stacked ensembles, eliminating the need for arbitrary determination of the number of top features to be extracted. This utility is invaluable for researchers analyzing feature significance, particularly within severely imbalanced outcomes where conventional methods fall short. Moreover, it is also expected to report democratic feature importance across a grid of models, resulting in a more comprehensive and generalizable feature selection. The package further implements a novel method for visualizing SHAP values both at subject level and feature level as well as a plot for feature selection based on the weighted mean SHAP ratios.

Authors:E. F. Haghish [aut, cre, cph]

shapley_0.3.tar.gz
shapley_0.3.zip(r-4.5)shapley_0.3.zip(r-4.4)shapley_0.3.zip(r-4.3)
shapley_0.3.tgz(r-4.4-any)shapley_0.3.tgz(r-4.3-any)
shapley_0.3.tar.gz(r-4.5-noble)shapley_0.3.tar.gz(r-4.4-noble)
shapley_0.3.tgz(r-4.4-emscripten)shapley_0.3.tgz(r-4.3-emscripten)
shapley.pdf |shapley.html
shapley/json (API)

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

Peer review:

Bug tracker:https://github.com/haghish/shapley/issues

On CRAN:

class-imbalanceclass-imbalance-problemfeature-extractionfeature-importancefeature-selectionmachine-learningmachine-learning-algorithmsshapshap-analysisshap-valuesshapelyshapley-additive-explanationsshapley-decompositionshapley-valueshapley-valuesshapleyvalueweighted-shapweighted-shap-confidence-intervalweighted-shapleyweighted-shapley-ci

6 exports 10 stars 2.16 score 69 dependencies 15 scripts 602 downloads

Last updated 2 months agofrom:5b8652c360. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKJul 08 2024
R-4.5-winOKJul 08 2024
R-4.5-linuxOKJul 08 2024
R-4.4-winOKJul 08 2024
R-4.4-macOKJul 08 2024
R-4.3-winOKJul 08 2024
R-4.3-macOKJul 08 2024

Exports:h2o.get_idsshapleyshapley.feature.selectionshapley.plotshapley.testshapley.top

Dependencies:base64encbitopsbslibcachemclicolorspacecrosstalkcurldigestDTevaluateextrafontextrafontdbfansifarverfastmapfontawesomefsggplot2gluegridExtragtableh2ohighrhtmltoolshtmlwidgetshttpuvisobandjquerylibjsonliteknitrlabelinglaterlatticelazyevallifecyclemagrittrMASSMatrixmemoisemgcvmimemunsellnlmepillarpkgconfigplyrpromisesR6rappdirsRColorBrewerRcppRCurlrlangrmarkdownRttf2pt1sassscalesstringistringrtibbletinytexutf8vctrsviridisLitewafflewithrxfunyaml