MyNixOS website logo
Description

Local Individual Conditional Expectation.

Local Individual Conditional Expectation ('localICE') is a local explanation approach from the field of eXplainable Artificial Intelligence (XAI). 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 libraries, a predict function has to be provided as an argument in order to get access to the model. Reference to the ICE approach: Alex Goldstein, Adam Kapelner, Justin Bleich, Emil Pitkin (2013) <arXiv:1309.6392>.

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 libraries are MLR, randomForest, caret or all other with an S3 predict function. For further model types from other libraries, 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:

if(require("h2o") && require("mlbench")){
  h2o.init()

  # Wrapping the h2o predict function and data type:
  predict.fun = function(model,newdata){
    prediction = h2o.predict(model, as.h2o(newdata))
    prediction = as.data.frame(prediction)
    return(prediction$predict)
  }

  # Get data and train a random forest
  data("PimaIndiansDiabetes")
  rf = h2o.randomForest(y = "glucose", training_frame = as.h2o(PimaIndiansDiabetes))

  # Get explanation
  explanation = localICE(
    instance = PimaIndiansDiabetes[1, ],
    data = PimaIndiansDiabetes,
    feature_1 = "age",
    feature_2 = "diabetes",
    target = "glucose",
    model = rf,
    regression = TRUE,
    predict.fun = predict.fun,
    step_1 = 5
  )
  plot(explanation)
  h2o.shutdown(prompt = FALSE)
}

Installation

For official version, install via CRAN:

install.packages("localICE")
require("localICE")
help("localICE")

For developmental version, install via GitHub:

if(require("devtools")){
  install_github("viadee/localICE")  
}

License

BSD 3-Clause License

Authors

Martin Walter - Initial work.

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows