8495023508

8495023508



breakDown plots

Linear model


visual explanations for Im/glm models

Logistic regression



Linear models are widely used in predictive modeling.

They have simple structure, which makes them easy to deploy or implement.

But models with many variables are hard to understand.

The breakDown plot explains the relation between variables and model prediction for a new observation.

Explanations are generated in three steps:

1} create model with lm() function

2)    break down model predictions with the broken() function

3)    plot the graphical summary with the generic plot() function.


libraryfbreakDown)

library(ggplot2)

model <- lm(quality - ., data =

wineOuality)

br <- brokenlmodel, wineOuality[1,],

baseline = "Intercept1

')

br

»> contribution

#> residual.sugar = 20.7

1.20000

9> density = 1.001

-1.00000

#> alcohol = 8.8

-0.33000

#> pH = 3

-0.13000

»> free.sulfur.dioxide = 45

0.03600

#> sulphates = 0.45

-0.02500

9> volatile.acidity = 0.27

0.01500

»> fixed.acidity = 7

0.00950

#> total.sulfur.dioxide = 170

-0.00900

9> citric.acid = 0.36

0.00057

#> chlorides = 0.045

0.00019

#> finał prognosis »> baseline: 5.877909

-0.32000

plot(br)


breakDown plots may be also used to explain predictions from the logistic regression model.

On the OX axis one may present linear predictions (default) or use probit/logit transformation to present contributions of variables from the model. Use the trans= argument to define the transformation.

The baseline is presented by the vertical black linę in the plot. One may set the baseline to 0 or to population average (use the baseline - “intercept" argument/


librarylbreakDown)

library(ggplot2)

model <- glm(left~., data = HR_data,

family = "binomial"

■)

explain_l <- brokenfmodel, HR_data(ll,],

baseline = "intercept")

explain_l

#> contribution

#> satisfaction_level = 0.45

0.670

#> number_project = 2

0.570

#> salary = Iow

0.390

tf> average_montly_hours = 135

-0.290

#> Work_accident = 0

0.220

#> time_spend_company = 3

-0.130

#> last_evaluation = 0.54

-0.130

#> promotion_last_5years = 0

0.030

#> sales = sales

0.014

*> finał prognosis

1.300

#> baseline: -1.601457

plot(explain 1, trans = function(x)

exp(x)/(l+exp(x)))


breakDown plot for predicted quality of a winę


Predicted probability of leaving the company


final_prognosis chlorides - 0 045 citric.acid * 0.36 totai.sulfur.doxKle = 170 flxed.aadity * 7 volatile.ac«dity ■ 0.27 sulphates ■ 0.45 free sulfur dioxide ■ 45 pH = 3 alcohol = 8.8 density = 1.001 residual.sugar ■ 20.7


-1

1.2


fir\al_prognosis


sates = sales


promolion_lasl_5years = 0


lasl_cvaluaton = 0 54


time_spend_company = 3


Work accident ■ 0


average_monBy_hours = 135


salary = kw/


numb«r_project = 2


satisfacbon level = 0.45


000


0.0035

-0.073

0.096

025

0.50

probability


0 75


1 Ol


CC BY Przemysław B<ecek • pr«myslaw.bie<efcSjigmaiLcom •http://github.com/pbiecek- Leam moce at https://pbiecek.github.io/breakDown/ • package yersion 0.1.1 • Updated: 2017-11




Wyszukiwarka

Podobne podstrony:
Ustawic elementy na stosie S w porzadku rosnacym2 ml = S.si/c( ).y = for (im i -0: i<x: i++) for
1. JAGUAR VIN# CODĘ EXPLANATIONS FOR YEARS 78.5-19802. JAGUAR VIN # CODĘ EXPLANATIONS FOR YEARS
1911115u7925057595082&79620096799059633 o 3 - rn=input (1 podaj rn= ) ; 4 - n=input( podaj n= 5
^5^ 38! I N FOR IM W IWM..1Hr«PORADNIKRACHUNKOWOŚCIBUDŻETOWEJ 1 (157) styczeń 2020 Izabela
C0VID-19 Antigen Rapid Test (07AG6000A)Explanation for Symbols SYMBOL
ALG!8 218 Rozdział 8. Przeszukiwanie tekstów for(i—M 1,j —M-l; j>0; i — , j—) while(t[i]!=włj)) (
] □ x Explanation for JimiHendrixMusicCD SubClassOf GuitarMusicCD • Show regular justifications • Al
00089 8f7b0c57f2bf2f1d0044db398ef2f1 88Hurwitz & Mathur The ARL s for three sets of L & U
ALI CENTURY INSTRUMENTS ARE GUARANTEED FOR ONE FULL YEAR The extremely Iow prices are
L Twin.fin.-i(U^Tuntf« ANOTHER F=nf=?S~T FOR ALBEPTSON 51 SICMAN 3 Vor*liM *. Our Meats Are
XLANDINGGEAR Notę: It makes no difference which parts you use for the rear landing gear, l
the leaders in Iow Cost Professional Quality CAD softwareLook for the IMEW family of software If you
Special Techniąues Instructions for Entrclac paltem: The indriidunl areas of color are worked in Moc
72706 tmta3 9. Fuli pattern and layout for Fig 7 For this smali size the Back and Front are shown o
piraha0080 67.80 4 REQUIRED, (two for rfght sida arm, two for Ioft) MATERIAŁ = (mm M/S Plato NOTĘ: A
jff 058 BASIC PIYOTS FOR THROWING Sixth Pivot: Two-Foot-Jump. Players are morę than norma! distance
Configuration The matching system is shown in Figurę 3.9. For the reasons described in a later parag

więcej podobnych podstron