Skip to content

Commit

Permalink
Site update
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymiuks committed Aug 25, 2019
1 parent 0558277 commit d53cd57
Show file tree
Hide file tree
Showing 19 changed files with 254 additions and 151 deletions.
122 changes: 68 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,95 @@
Status](https://travis-ci.org/ModelOriented/DALEXtra.svg?branch=master)](https://travis-ci.org/ModelOriented/DALEXtra)
[![Coverage
Status](https://img.shields.io/codecov/c/github/ModelOriented/DALEXtra/master.svg)](https://codecov.io/github/ModelOriented/DALEXtra?branch=master)
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/DALEXtra)](https://cran.r-project.org/package=DALEXtra)

An extension for DALEX package
## Overview

# Anaconda
The `DALEXtra` package is an extension pack for
[DALEX](https://modeloriented.github.io/DALEX) package. This package
provides easy to use connectors for models created with scikitlearn,
keras, H2O, mljar and mlr.

In order to be able to use some features associated with `DALEXtra`,
Anaconda in needed. The easiest way to get it, is visting [Anconda
website](https://www.anaconda.com/distribution). And choosing proper OS
as it stands in the following picture.
![](README_files/figure-gfm/anaconda1.png) There is no big difference
bewtween Python versions when downloading conda therefore it is
recommended to choose Python 3.7 (newer Anaconda version) and then
downloading python 2.7.
## Installation

## Windows

Crucial thing is adding conda to PATH environment variable when using
Windows. You can do it during installation, by marking this checkbox.
# Install the development version from GitHub:

# it is recommended to install latest version of DALEX from GitHub
devtools::install_github("ModelOriented/DALEX")
# install.packages("devtools")
devtools::install_github("ModelOriented/DALEXtra")

![](README_files/figure-gfm/anaconda2.png)
Package `reticulate` will be downloaded along with `DALEXtra` but if you
seek for it’s latests version it can be downloaded here

or, if conda is already installed, by following [those
instructions](https://stackoverflow.com/a/44597801/9717584).
devtools::install_github("rstudio/reticulate")

## Unix
Other packages useful with explanations.

While using unixlike OS, adding conda to PATH is not required.
devtools::install_github("ModelOriented/ingredients")
devtools::install_github("ModelOriented/iBreakDown")
devtools::install_github("ModelOriented/shapper")
devtools::install_github("ModelOriented/auditor")

# Installation and configuration
Above packages can be used along with `explain` object to create
explanations (ingredients, iBreakDown, shapper) or audit our model
(audiotr).

Package can be installed with execution of the following code
## How to setup Anaconda

install.packages("devtools")
devtools::install_github("ModelOriented/DALEXtra")
devtools::install_github("ModelOriented/DALEX")
In order to be able to use some features associated with `DALEXtra`,
Anaconda in needed. The easiest way to get it, is visting [Anconda
website](https://www.anaconda.com/distribution). And choosing proper OS
as it stands in the following picture.
![](https://raw.githubusercontent.com/ModelOriented/DALEXtra/master/README_files/figure-gfm/anaconda1.png)
There is no big difference bewtween Python versions when downloading
Anaconda. You can always create virtual environment with any version of
Pytho no matter which version was downloaded first.

It is recommended to install latests github version of DALEX
### Windows

Package `reticulate` will be downloaded along with `DALEXtra` but if you
seek for its latests version it can be downloaded here
Crucial thing is adding conda to PATH environment variable when using
Windows. You can do it during installation, by marking this
checkbox.

devtools::install_github("rstudio/reticulate")
![](https://raw.githubusercontent.com/ModelOriented/DALEXtra/master/README_files/figure-gfm/anaconda2.png)

Packages useful with explanations
or, if conda is already installed, by following [those
instructions](https://stackoverflow.com/a/44597801/9717584).

devtools::install_github("ModelOriented/ingredients")
devtools::install_github("ModelOriented/iBreakDown")
devtools::install_github("ModelOriented/shapper")
devtools::install_github("ModelOriented/auditor")
### Unix

<https://modeloriented.github.io/DALEXtra/>
While using unixlike OS, adding conda to PATH is not required.

# Demo
## Demo

Here we will present short use case for our package and its
compatibility with Python

## Loading data
### Loading data

First we need data, explainer is useless without them. Thing is Python
object does not store training data so always have to proviede dataset.
Feel free to use those attached to `DALEX` package or those stored in
`DALEXtra`
First we need provide the data, explainer is useless without them. Thing
is Python object does not store training data so always have to provide
dataset. Feel free to use those attached to `DALEX` package or those
stored in `DALEXtra`
files.

``` r
titanic_test <- read.csv(system.file("extdata", "titanic_test.csv", package = "DALEXtra"))
```

Keep in mind that that dataframe includes targer variable (18th column)
and scikit-learn models do not like it
Keep in mind that dataframe includes target variable (18th column) and
scikit-learn models cannot work with it.

## Creating explainer
### Creating explainer

Creating exlainer from scikit-learn Python model is very simple thanks
to `DALEXtra`. The only thing you need to provide is path to pickle and,
if necessery, something that lets recognize Python environment. It may
be .yml file with packages specification, name of existing conda
environment or path to Python virtual environment. Execution of
`scikitlearn_explain` only with .pkl file and data will cause usage of
default Python.

``` r
library(DALEXtra)
Expand All @@ -96,18 +112,11 @@ data = titanic_test[,1:17], y = titanic_test$survived)
## -> residuals : numerical, min = -0.8669431 , mean = 0.02248468 , max = 0.9791387
## A new explainer has been created!

Creating exlainer from scikit-learn Python model is very simple thanks
to `DALEXtra`. The only thing you need to provide is path to pickle and,
if necessery, something that lets recognize Python environment. It may
be .yml file with packages specification, name of existing conda
environment or path to Python virtual environment. Execution of
`scikitlearn_explain` only with .pkl file and data will cause usage of
default Python.

## Creating explanations
### Creating explanations

Now with explainer ready we can use any of DrWhy.ai universe tools to
make explanations. Here is a small demo
Now with explainer ready we can use any of
[DrWhy.ai](https://github.com/ModelOriented/DrWhy/blob/master/README.md)
universe tools to make explanations. Here is a small demo.

``` r
library(DALEX)
Expand Down Expand Up @@ -170,3 +179,8 @@ predict(explainer, titanic_test[1:10, 1:17])

## [1] 0.3565896 0.1321947 0.7638813 0.1037486 0.1265221 0.2949228 0.1421281
## [8] 0.1421281 0.4154695 0.1321947

## Acknowledgments

Work on this package was financially supported by the ‘NCN Opus grant
2016/21/B/ST6/02176’.
Binary file modified README_files/figure-gfm/unnamed-chunk-3-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/unnamed-chunk-3-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
template:
package: DrWhyTemplate
default_assets: false
home:
links:
- text: Source code
href: https://github.com/ModelOriented/DALEXtra

reference:
- title: Explainers
Expand Down
7 changes: 6 additions & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d53cd57

Please sign in to comment.