modelDown: a website generator for your predictive models

I love the pkgdown package. With a single line of code you can create a complete website with examples, vignettes and documentation for your package. Brilliant!

So what about a website generator for predictive models?
Imagine that you can take a set of predictive models (generated with caret, mlr, glm, xgboost or randomForest, anything) and automagically generate a website with an exploration/documentation for these models. A documentation with archvist hooks to models, with tables and graphs for model performance explainers, conditional model response explainers or explainers for particular predictions.

During the summer semester three students from Warsaw University of Technology (Kamil Romaszko, Magda Tatarynowicz, Mateusz Urbański) developed modelDown package for R as an team project assignment. You can find the package here. Visit an example website created with this package for four example models (instructions). And read more about this package at its pkgdown website or below.

BTW: If you want to learn more about model explainers, please come to our DALEX workshops at WhyR? 2018 conference in Wroclaw or UseR! 2018 conference in Brisbane.

Getting started with modelDown
by Kamil Romaszko, Magda Tatarynowicz, Mateusz Urbański

Introduction

Did you ever want to have one place where you can find information explaining your model? Or maybe you were missing a tool that can show difference in multiple models for the same dataset? Well, here comes modelDown package. By using DALEX package, it creates one html page with plots and information related to the model(s) you want to analyze.

If you want to check out example website generated with modelDown, check out this link (along with script that was used to create the html). Read on to see how to use package for your own models and what features it provides.

The examples presented here were generated for dataset HR_data from breakDown package (available on CRAN). The dataset contains various information about employees (for example their satisfaction from work or their salary). The information we predict is whether they left the company.

Installation
First things first – how can you use this package? Install it from github:

devtools::install_github("MI2DataLab/modelDown")

Czytaj dalej modelDown: a website generator for your predictive models

Z pamiętnika nauczyciela akademickiego: Challenge-Based Learning


Challenge-Based Learning to technika uczenia przez zderzanie uczestników (studenci, uczniowie) ze współczesnym, ciekawym, rzeczywistym problemem do rozwiązania.
Aby taki problem rozwiązać, uczestnicy muszą zrobić badania literaturowe, zrozumieć problem, zaprojektować rozwiązanie i to najlepiej działające. Ta technika jest coraz częściej stosowana w szkołach średnich i podstawowych otwartych na nowe formy nauczania. Rozmawiałem ostatnio z twórcą koderka (aktywności dla dzieci związane z informatyką i nowymi technologiami) o edukacji STEM dla dzieci i młodzieży. Wątek Challenge-Based Learning pojawiał się nieustannie.

A jak to może wyglądać na uczelni?
Od jakiegoś czasu (ojej, to już 10 lat?) testuję różne techniki edukacyjne na zajęciach. Tym razem sprawdzałem pewien pomysł wzorowany na Challenge-Based Learning. Poniżej opiszę sam pomysł wraz z moimi obserwacjami po przeprowadzeniu zajęć.

Zaprojektowany by upaść

Jak pokazać na zajęciach wyzwania, jakie niesie komunikacja przy budowaniu wspólnego rozwiązania przez wiele osób?
W letnim semestrze prowadziłem Zaawansowane programowanie i analizę danych w R na MiNI PW. Jako drugi projekt studenci wykonali inteligentnego asystenta, pakiet R, który pomaga w pracy analityka danych wykonując co trudniejsze/żmudniejsze czynności (jak już raz się nauczy wczytywać dane to nie będzie w kółko pytać o te same parametry analityka).

Każdy z 14 studentów (luksus pracy z małymi grupami) dostał do wykonania jedną funkcjonalność. W sumie te funkcjonalności powinny złożyć się w jeden pakiet – jednego asystenta wspierającego pracę analityka.
Wciąż, jeden student opiekuje się jedną przypisaną mu funkcjonalnością – wczytaj dane, wykonaj preprocessing danych, przeprowadź budowę modelu predykcyjnego, wygeneruj raport, zapisz wykres, odtwórz sesji itp.
Zaliczenie projektu dotyczy częściowo tej jednej funkcjonalności a częściowo spójności rozwiązania z całą resztą pakietu.
Pomimo iż każdy opiekuje się swoją częścią to też opłaca się wszystkim by całość działała.
A jak wiadomo, całość to więcej niż suma składowych.
Wspomniany asystent nazywa się Hugo. Jeżeli chcecie go poznać bliżej, to zerknijcie na https://github.com/hugo4r/hugo.

Czytaj dalej Z pamiętnika nauczyciela akademickiego: Challenge-Based Learning

Not only LIME

I’ve heard about a number of consulting companies, that decided to use simple linear model instead of a black box model with higher performance, because ,,client wants to understand factors that drive the prediction’’.
And usually the discussion goes as following: ,,We have tried LIME for our black-box model, it is great, but it is not working in our case’’, ,,Have you tried other explainers?’’, ,,What other explainers’’?

So here you have a map of different visual explanations for black-box models. Choose one in (on average) less than three simple steps.

These are available in the DALEX package. Feel free to propose other visual explainers that should be added to this map (and the package).

Ceteris Paribus Plots – a new DALEX companion

If you like magical incantations in Data Science, please welcome the Ceteris Paribus Plots. Otherwise feel free to call them What-If Plots.

Ceteris Paribus (latin for all else unchanged) Plots explain complex Machine Learning models around a single observation. They supplement tools like breakDown, Shapley values, LIME or LIVE. In addition to feature importance/feature attribution, now we can see how the model response changes along a specific variable, keeping all other variables unchanged.

How cancer-risk-scores change with age? How credit-scores change with salary? How insurance-costs change with age?

Well, use the ceterisParibus package to generate plots like the one below.
Here we have an explanation for a random forest model that predicts apartments prices. Presented profiles are prepared for a single observation marked with dashed lines (130m2 apartment on 3rd floor). From these profiles one can read how the model response is linked with particular variables.

Instead of original values on the OX scale one can plot qunatiles. This way one can put all variables in a single plot.

And once all variables are in the same scale, one can compare two or more models.

Yes, they are model agnostic and will work for any model!
Yes, they can be interactive (see plot_interactive function or examples below)!
And yes, you can use them with other DALEX explainers!
More examples with R code.