GithubHelp home page GithubHelp logo

viadee / localice Goto Github PK

View Code? Open in Web Editor NEW
7.0 12.0 0.0 387 KB

Local Individual Conditional Expectation (localICE) is a local explanation approach from the field of eXplainable Artificial Intelligence (XAI)

License: Other

R 100.00%
explainable-ai ai r ggplot visualization machine-learning

localice's Introduction

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:

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

localice's People

Contributors

aiwalter avatar fkoehne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.