项目作者: viadee

项目描述 :
本地个人条件期望(localICE)是可扩展人工智能(XAI)领域的局部解释方法
高级语言: R
项目地址: git://github.com/viadee/localICE.git
创建时间: 2019-01-09T10:36:48Z
项目社区:https://github.com/viadee/localICE

开源协议:Other

下载


CRAN Status Badge
GitHub Status Badge
Build Status
codecov
CRAN Downloads

License

localICE

Local Individual Conditional Expectation (localICE) is a local explanation approach from the field of eXplainable Artificial Intelligence (XAI). This is the repository of the R-package localICE.

Introduction

Idea

localICE is a model-agnostic XAI approach which provides three-dimensional local explanations for particular data instances. The approach is proposed in the master thesis of Martin Walter as an extension to ICE (see Reference). The three dimensions are the two features at the horizontal and vertical axes as well as the target represented by different colors. The approach is applicable for classification and regression problems to explain interactions of two features towards the target. For classification models, the number of classes can be more than two and each class is added as a different color to the plot. The given instance is added to the plot as two dotted lines according to the feature values. The localICE-package can explain features of type factor and numeric of any machine learning model. Automatically supported machine learning packages are mlr, randomForest, caret or all other with an S3 predict function. For further model types from other packages, a predict function has to be provided as an argument in order to get access to the model, as described below by means of an example with the h2o library.

Reference

Alex Goldstein et al. “Peeking Inside the Black Box: Visualizing Statistical Learning With Plots of Individual Conditional Expectation”. In: Journal of Computational and Graphical Statistics 24.1 (2013), pp. 44–65. URL: http://arxiv.org/abs/1309.6392

Examples

Regression

![regression]

Classification

![classification]

Using localICE with any machine learning library, in this case with h2o:

  1. if(require("h2o") && require("mlbench")){
  2. h2o.init()
  3. # Wrapping the h2o predict function and data type:
  4. predict.fun = function(model,newdata){
  5. prediction = h2o.predict(model, as.h2o(newdata))
  6. prediction = as.data.frame(prediction)
  7. return(prediction$predict)
  8. }
  9. # Get data and train a random forest
  10. data("PimaIndiansDiabetes")
  11. rf = h2o.randomForest(y = "glucose", training_frame = as.h2o(PimaIndiansDiabetes))
  12. # Get explanation
  13. explanation = localICE(
  14. instance = PimaIndiansDiabetes[1, ],
  15. data = PimaIndiansDiabetes,
  16. feature_1 = "age",
  17. feature_2 = "diabetes",
  18. target = "glucose",
  19. model = rf,
  20. regression = TRUE,
  21. predict.fun = predict.fun,
  22. step_1 = 5
  23. )
  24. plot(explanation)
  25. h2o.shutdown(prompt = FALSE)
  26. }

Installation

For official version, install via CRAN:

  1. install.packages("localICE")
  2. require("localICE")
  3. help("localICE")

For developmental version, install via GitHub:

  1. if(require("devtools")){
  2. install_github("viadee/localICE")
  3. }

License

BSD 3-Clause License

Authors

Martin Walter - Initial work

[regression]:
https://github.com/viadee/localICE/blob/master/images/regression.png
“Regression”

[classification]:
https://github.com/viadee/localICE/blob/master/images/classification.png
“Classification”