Skip to content

shapley

0.7.0Package record

Weighted Mean SHAP and CI for Robust Feature Assessment in ML Grid

1packages depend
5.6Kdownloads / year
–test coverage
13/13flavors OK

Overview

About

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.

Install

Health

CRAN checks
13OK
Slowest check: 1.8 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-08
  • NOTE12 OK, 1 NOTE2026-06-07
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.7.0
READMEYes · 1,943 wordsVignettesNoNEWSNoCitation fileNo
Help pages
12
Examples that run
0%11 never run
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

5.6K
CRAN downloads in the past year
Rank #8,172 · ~15/day · ~467/mo
Daily download trend is not available in this view yet.
37130 days
1.1K90 days
5.6K1 year
Compare downloads with other packages →
Also on100 r2u

Repository

18Stars
3Forks
0Open issues
0Open PRs
6Releases
254Commits
1Commit identities
machine-learningmachine-learning-algorithmsshap-analysisshap-valuesshapelyclass-imbalanceclass-imbalance-problemfeature-extraction
254 commits · Last activity 2026-04-26 · 0% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
not measured
Median days to close, 50 most recently updated closed issues
262
Median days to close, 50 most recently updated closed PRs
not measured

Stars over time

2025-07-31 · 172026-07-07 · 18
PracticesBeta

2 development-tooling and community-health practices detected across 2 families in the upstream repository

Checks run against github.com/haghish/shapley on 2026-10-25.

Docs source (1)

GitHub Pages site last deployed 2026-02-12

Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
4 external dependencies (excludes base and recommended)

Installing shapley adds 25 packages (14 with compiled code, 19 MB of source tarballs). Heaviest: ggplot2 6.0 MB, Rcpp 1.8 MB, isoband 1.5 MB.

Depends (1)
R >= 3.5.0
LinkingTo (0)
none
Suggests (0)
none
Enhances (0)
none
Reverse dependencies
1direct
0indirect
Imports 1
Depends, Imports or LinkingTo, most downloaded first

People & History

People (1)
Author, Maintainer since 0.1 (2023), Copyright holder
Releases (7)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 0.7.0Latest
    record
    2026-03-04 · current release · diff ↗
  • 0.6.0
    record
    2026-02-13 · diff ↗ ·
    added 1 export
    shapley.domain.test
  • unarchivedReturned to CRAN
    2025-09-18
  • 0.5.1
    record
    2025-09-18 · diff ↗
  • archivedRemoved from CRAN
    2025-09-09
    requires archived package 'waffle'
  • R
    R 4.5.0 released · 2025-04-11
  • 0.5
    record
    2025-03-19 · diff ↗ ·
    removed 2 exports
    shapley.feature.selection, shapley.test
    added 2 exports
    shapley.feature.test, shapley.table
  • 0.4
    record
    2024-10-23 · diff ↗ ·
    added 2 exports
    shapley.domain, shapley.row.plot
  • 0.3
    record
    2024-05-30 · diff ↗ ·
    added 1 export
    shapley.feature.selection
  • R
    R 4.4.0 released · 2024-04-24
  • 0.1
    record
    2023-11-07
  • R
    R 4.3.0 released · 2023-04-21

Package metadata

First published
2023-11-07
Total releases
7 / 3 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 3.5.0
Download size
739 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("shapley")
E. F. Haghish. (2026). shapley: Weighted Mean SHAP and CI for Robust Feature Assessment in ML Grid (Version 0.7.0) [Computer software]. https://doi.org/10.32614/CRAN.package.shapley

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for shapley version 0.7.0 [Data set]. HJJB, LLC. Data release v2026-10-26. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy