Skip to content

Commit

Permalink
interesting chapter 17
Browse files Browse the repository at this point in the history
  • Loading branch information
theAfricanQuant committed Apr 28, 2023
1 parent 8e6b799 commit 0e73851
Show file tree
Hide file tree
Showing 5 changed files with 3,684 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .ipynb_checkpoints/chp17_ModelInterpretation-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
3,546 changes: 3,546 additions & 0 deletions chp17_ModelInterpretation.ipynb

Large diffs are not rendered by default.

Binary file added img/.ipynb_checkpoints/rf_xg_kag-checkpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions img/.ipynb_checkpoints/sur-sk-checkpoint.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
digraph Tree {
node [shape=box, style="filled", color="black", fontname="Roboto Condensed"] ;
edge [fontname="Roboto Condensed"] ;
rankdir=LR ;
0 [label="r <= 0.5\nsquared_error = 0.121\nsamples = 2110\nvalue = 0.454", fillcolor="#f3c4a2"] ;
1 [label="major_cs <= 0.5\nsquared_error = 0.103\nsamples = 1484\nvalue = 0.559", fillcolor="#efb489"] ;
0 -> 1 [labeldistance=2.5, labelangle=-45, headlabel="True"] ;
2 [label="Q3_United States of America <= 0.5\nsquared_error = 0.115\nsamples = 718\nvalue = 0.429", fillcolor="#f4c8a8"] ;
1 -> 2 ;
3 [label="major_stat <= 0.5\nsquared_error = 0.086\nsamples = 322\nvalue = 0.564", fillcolor="#efb387"] ;
2 -> 3 ;
4 [label="squared_error = 0.072\nsamples = 285\nvalue = 0.603", fillcolor="#eead7e"] ;
3 -> 4 ;
5 [label="squared_error = 0.098\nsamples = 37\nvalue = 0.265", fillcolor="#f9e1d0"] ;
3 -> 5 ;
6 [label="years_exp <= 4.5\nsquared_error = 0.111\nsamples = 396\nvalue = 0.319", fillcolor="#f7d9c3"] ;
2 -> 6 ;
7 [label="squared_error = 0.071\nsamples = 294\nvalue = 0.237", fillcolor="#fae6d7"] ;
6 -> 7 ;
8 [label="squared_error = 0.153\nsamples = 102\nvalue = 0.554", fillcolor="#f0b48a"] ;
6 -> 8 ;
9 [label="years_exp <= 3.5\nsquared_error = 0.061\nsamples = 766\nvalue = 0.681", fillcolor="#eca16b"] ;
1 -> 9 ;
10 [label="age <= 27.5\nsquared_error = 0.052\nsamples = 525\nvalue = 0.625", fillcolor="#eda978"] ;
9 -> 10 ;
11 [label="squared_error = 0.041\nsamples = 460\nvalue = 0.65", fillcolor="#eda673"] ;
10 -> 11 ;
12 [label="squared_error = 0.1\nsamples = 65\nvalue = 0.453", fillcolor="#f3c4a2"] ;
10 -> 12 ;
13 [label="education <= 17.0\nsquared_error = 0.057\nsamples = 241\nvalue = 0.803", fillcolor="#e88e4d"] ;
9 -> 13 ;
14 [label="squared_error = 0.027\nsamples = 113\nvalue = 0.885", fillcolor="#e58139"] ;
13 -> 14 ;
15 [label="squared_error = 0.072\nsamples = 128\nvalue = 0.73", fillcolor="#ea995f"] ;
13 -> 15 ;
16 [label="major_cs <= 0.5\nsquared_error = 0.074\nsamples = 626\nvalue = 0.203", fillcolor="#fbebdf"] ;
0 -> 16 [labeldistance=2.5, labelangle=45, headlabel="False"] ;
17 [label="years_exp <= 7.5\nsquared_error = 0.043\nsamples = 443\nvalue = 0.123", fillcolor="#fdf7f3"] ;
16 -> 17 ;
18 [label="education <= 14.5\nsquared_error = 0.03\nsamples = 382\nvalue = 0.105", fillcolor="#fefaf7"] ;
17 -> 18 ;
19 [label="squared_error = 0.0\nsamples = 1\nvalue = 0.873", fillcolor="#e5833c"] ;
18 -> 19 ;
20 [label="squared_error = 0.029\nsamples = 381\nvalue = 0.103", fillcolor="#fefbf8"] ;
18 -> 20 ;
21 [label="education <= 19.5\nsquared_error = 0.11\nsamples = 61\nvalue = 0.236", fillcolor="#fae6d8"] ;
17 -> 21 ;
22 [label="squared_error = 0.133\nsamples = 40\nvalue = 0.32", fillcolor="#f7d9c3"] ;
21 -> 22 ;
23 [label="squared_error = 0.027\nsamples = 21\nvalue = 0.074", fillcolor="#ffffff"] ;
21 -> 23 ;
24 [label="years_exp <= 4.5\nsquared_error = 0.096\nsamples = 183\nvalue = 0.397", fillcolor="#f5cdb0"] ;
16 -> 24 ;
25 [label="education <= 17.0\nsquared_error = 0.071\nsamples = 144\nvalue = 0.34", fillcolor="#f6d6be"] ;
24 -> 25 ;
26 [label="squared_error = 0.061\nsamples = 69\nvalue = 0.43", fillcolor="#f4c8a8"] ;
25 -> 26 ;
27 [label="squared_error = 0.066\nsamples = 75\nvalue = 0.257", fillcolor="#f9e3d2"] ;
25 -> 27 ;
28 [label="education <= 17.0\nsquared_error = 0.131\nsamples = 39\nvalue = 0.609", fillcolor="#eeac7d"] ;
24 -> 28 ;
29 [label="squared_error = 0.035\nsamples = 13\nvalue = 0.862", fillcolor="#e6853f"] ;
28 -> 29 ;
30 [label="squared_error = 0.131\nsamples = 26\nvalue = 0.482", fillcolor="#f2c09b"] ;
28 -> 30 ;
}
66 changes: 66 additions & 0 deletions img/sur-sk.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
digraph Tree {
node [shape=box, style="filled", color="black", fontname="Roboto Condensed"] ;
edge [fontname="Roboto Condensed"] ;
rankdir=LR ;
0 [label="r <= 0.5\nsquared_error = 0.121\nsamples = 2110\nvalue = 0.454", fillcolor="#f3c4a2"] ;
1 [label="major_cs <= 0.5\nsquared_error = 0.103\nsamples = 1484\nvalue = 0.559", fillcolor="#efb489"] ;
0 -> 1 [labeldistance=2.5, labelangle=-45, headlabel="True"] ;
2 [label="Q3_United States of America <= 0.5\nsquared_error = 0.115\nsamples = 718\nvalue = 0.429", fillcolor="#f4c8a8"] ;
1 -> 2 ;
3 [label="major_stat <= 0.5\nsquared_error = 0.086\nsamples = 322\nvalue = 0.564", fillcolor="#efb387"] ;
2 -> 3 ;
4 [label="squared_error = 0.072\nsamples = 285\nvalue = 0.603", fillcolor="#eead7e"] ;
3 -> 4 ;
5 [label="squared_error = 0.098\nsamples = 37\nvalue = 0.265", fillcolor="#f9e1d0"] ;
3 -> 5 ;
6 [label="years_exp <= 4.5\nsquared_error = 0.111\nsamples = 396\nvalue = 0.319", fillcolor="#f7d9c3"] ;
2 -> 6 ;
7 [label="squared_error = 0.071\nsamples = 294\nvalue = 0.237", fillcolor="#fae6d7"] ;
6 -> 7 ;
8 [label="squared_error = 0.153\nsamples = 102\nvalue = 0.554", fillcolor="#f0b48a"] ;
6 -> 8 ;
9 [label="years_exp <= 3.5\nsquared_error = 0.061\nsamples = 766\nvalue = 0.681", fillcolor="#eca16b"] ;
1 -> 9 ;
10 [label="age <= 27.5\nsquared_error = 0.052\nsamples = 525\nvalue = 0.625", fillcolor="#eda978"] ;
9 -> 10 ;
11 [label="squared_error = 0.041\nsamples = 460\nvalue = 0.65", fillcolor="#eda673"] ;
10 -> 11 ;
12 [label="squared_error = 0.1\nsamples = 65\nvalue = 0.453", fillcolor="#f3c4a2"] ;
10 -> 12 ;
13 [label="education <= 17.0\nsquared_error = 0.057\nsamples = 241\nvalue = 0.803", fillcolor="#e88e4d"] ;
9 -> 13 ;
14 [label="squared_error = 0.027\nsamples = 113\nvalue = 0.885", fillcolor="#e58139"] ;
13 -> 14 ;
15 [label="squared_error = 0.072\nsamples = 128\nvalue = 0.73", fillcolor="#ea995f"] ;
13 -> 15 ;
16 [label="major_cs <= 0.5\nsquared_error = 0.074\nsamples = 626\nvalue = 0.203", fillcolor="#fbebdf"] ;
0 -> 16 [labeldistance=2.5, labelangle=45, headlabel="False"] ;
17 [label="years_exp <= 7.5\nsquared_error = 0.043\nsamples = 443\nvalue = 0.123", fillcolor="#fdf7f3"] ;
16 -> 17 ;
18 [label="education <= 14.5\nsquared_error = 0.03\nsamples = 382\nvalue = 0.105", fillcolor="#fefaf7"] ;
17 -> 18 ;
19 [label="squared_error = 0.0\nsamples = 1\nvalue = 0.873", fillcolor="#e5833c"] ;
18 -> 19 ;
20 [label="squared_error = 0.029\nsamples = 381\nvalue = 0.103", fillcolor="#fefbf8"] ;
18 -> 20 ;
21 [label="education <= 19.5\nsquared_error = 0.11\nsamples = 61\nvalue = 0.236", fillcolor="#fae6d8"] ;
17 -> 21 ;
22 [label="squared_error = 0.133\nsamples = 40\nvalue = 0.32", fillcolor="#f7d9c3"] ;
21 -> 22 ;
23 [label="squared_error = 0.027\nsamples = 21\nvalue = 0.074", fillcolor="#ffffff"] ;
21 -> 23 ;
24 [label="years_exp <= 4.5\nsquared_error = 0.096\nsamples = 183\nvalue = 0.397", fillcolor="#f5cdb0"] ;
16 -> 24 ;
25 [label="education <= 17.0\nsquared_error = 0.071\nsamples = 144\nvalue = 0.34", fillcolor="#f6d6be"] ;
24 -> 25 ;
26 [label="squared_error = 0.061\nsamples = 69\nvalue = 0.43", fillcolor="#f4c8a8"] ;
25 -> 26 ;
27 [label="squared_error = 0.066\nsamples = 75\nvalue = 0.257", fillcolor="#f9e3d2"] ;
25 -> 27 ;
28 [label="education <= 17.0\nsquared_error = 0.131\nsamples = 39\nvalue = 0.609", fillcolor="#eeac7d"] ;
24 -> 28 ;
29 [label="squared_error = 0.035\nsamples = 13\nvalue = 0.862", fillcolor="#e6853f"] ;
28 -> 29 ;
30 [label="squared_error = 0.131\nsamples = 26\nvalue = 0.482", fillcolor="#f2c09b"] ;
28 -> 30 ;
}

0 comments on commit 0e73851

Please sign in to comment.