项目作者: bdwilliamson

项目描述 :
Perform inference on algorithm-agnostic variable importance
高级语言: R
项目地址: git://github.com/bdwilliamson/vimp.git
创建时间: 2016-06-08T18:38:49Z
项目社区:https://github.com/bdwilliamson/vimp

开源协议:Other

下载


" class="reference-link">R/vimp: inference on algorithm-agnostic variable importance

CRAN_Status_Badge
Travis-CI Build Status
AppVeyor Build Status
Coverage status
CRAN downloads
Project Status: Active – The project has reached a stable, usable state and is being actively developed.
License: MIT

Software authors: Brian Williamson, Jean Feng, and Charlie Wolock

Methodology authors: Brian Williamson, Peter Gilbert, Noah Simon, Marco Carone, Jean Feng

Python package: https://github.com/bdwilliamson/vimpy

Introduction

In predictive modeling applications, it is often of interest to determine the relative contribution of subsets of features in explaining an outcome; this is often called variable importance. It is useful to consider variable importance as a function of the unknown, underlying data-generating mechanism rather than the specific predictive algorithm used to fit the data. This package provides functions that, given fitted values from predictive algorithms, compute algorithm-agnostic estimates of population variable importance, along with asymptotically valid confidence intervals for the true importance and hypothesis tests of the null hypothesis of zero importance.

Specifically, the types of variable importance supported by vimp include: difference in population classification accuracy, difference in population area under the receiver operating characteristic curve, difference in population deviance, difference in population R-squared.

More detail may be found in our papers on R-squared-based variable importance, general variable importance, and general Shapley-based variable importance.

This method works on low-dimensional and high-dimensional data.

Issues

If you encounter any bugs or have any specific feature requests, please file an issue.

R installation

You may install a stable release of vimp from CRAN via install.packages("vimp"). You may also install a stable release of vimp from GitHub via devtools by running the following code (replace v2.1.0 with the tag for the specific release you wish to install):

  1. ## install.packages("devtools") # only run this line if necessary
  2. devtools::install_github(repo = "bdwilliamson/vimp@v2.1.0")

You may install a development release of vimp from GitHub via devtools by running the following code:

  1. ## install.packages("devtools") # only run this line if necessary
  2. devtools::install_github(repo = "bdwilliamson/vimp")

Example

This example shows how to use vimp in a simple setting with simulated data, using SuperLearner to estimate the conditional mean functions and specifying the importance measure of interest as the R-squared-based measure. For more examples and detailed explanation, please see the vignette.

  1. # load required functions and libraries
  2. library("SuperLearner")
  3. library("vimp")
  4. library("xgboost")
  5. library("glmnet")
  6. # -------------------------------------------------------------
  7. # problem setup
  8. # -------------------------------------------------------------
  9. # set up the data
  10. n <- 100
  11. p <- 2
  12. s <- 1 # desire importance for X_1
  13. x <- as.data.frame(replicate(p, runif(n, -1, 1)))
  14. y <- (x[,1])^2*(x[,1]+7/5) + (25/9)*(x[,2])^2 + rnorm(n, 0, 1)
  15. # -------------------------------------------------------------
  16. # get variable importance!
  17. # -------------------------------------------------------------
  18. # set up the learner library, consisting of the mean, boosted trees,
  19. # elastic net, and random forest
  20. learner.lib <- c("SL.mean", "SL.xgboost", "SL.glmnet", "SL.randomForest")
  21. # get the variable importance estimate, SE, and CI
  22. # I'm using only 2 cross-validation folds to make things run quickly; in practice, you should use more
  23. set.seed(20231213)
  24. vimp <- vimp_rsquared(Y = y, X = x, indx = 1, V = 2)

Citation

After using the vimp package, please cite the following (for R-squared-based variable importance):

  1. @article{williamson2020,
  2. author={Williamson, BD and Gilbert, PB and Carone, M and Simon, R},
  3. title={Nonparametric variable importance assessment using machine learning techniques},
  4. journal={Biometrics},
  5. year={2020},
  6. doi={10.1111/biom.13392}
  7. }

or the following (for general variable importance parameters):

  1. @article{williamson2021,
  2. author={Williamson, BD and Gilbert, PB and Simon, NR and Carone, M},
  3. title={A general framework for inference on algorithm-agnostic variable importance},
  4. journal={Journal of the American Statistical Association},
  5. year={2021},
  6. doi={10.1080/01621459.2021.2003200}
  7. }

or the following (for Shapley-based variable importance):

  1. @inproceedings{williamson2020,
  2. title={Efficient nonparametric statistical inference on population feature importance using {S}hapley values},
  3. author={Williamson, BD and Feng, J},
  4. year={2020},
  5. booktitle={Proceedings of the 37th International Conference on Machine Learning},
  6. volume={119},
  7. pages={10282--10291},
  8. series = {Proceedings of Machine Learning Research},
  9. URL = {http://proceedings.mlr.press/v119/williamson20a.html}
  10. }

License

The contents of this repository are distributed under the MIT license. See below for details:

  1. MIT License
  2. Copyright (c) [2018-present] [Brian D. Williamson]
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in all
  10. copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  17. SOFTWARE.

The logo was created using hexSticker and lisa. Many thanks to the maintainers of these packages and the Color Lisa team.