ReLU DNN Regression (Friedman)

Experiment initialization and data preparation

from piml import Experiment
from piml.models import ReluDNNRegressor

exp = Experiment()
exp.data_loader(data="Friedman", silent=True)
exp.data_summary(silent=True)
exp.data_prepare(target="target", task_type="regression", silent=True)

Train Model

exp.model_train(model=ReluDNNRegressor(hidden_layer_sizes=(40, 40), l1_reg=0.0002, learning_rate=0.001),
                name="ReLU-DNN")

Evaluate predictive performance

exp.model_diagnose(model='ReLU-DNN', show="accuracy_table")
          MSE     MAE       R2

Train  0.0007  0.0192   0.9784
Test   0.0009  0.0199   0.9709
Gap    0.0002  0.0007  -0.0075

Local Linear Model (LLM) summary plot

exp.model_interpret(model="ReLU-DNN", show="llm_summary", figsize=(5, 4))
    Count  Response Mean  Response Std  Local MSE  Global MSE
0   215.0         0.4711        0.1584     0.0005      0.0309
1   207.0         0.4700        0.1648     0.0005      0.0327
2   185.0         0.4592        0.1754     0.0004      0.0324
3   148.0         0.4698        0.1601     0.0003      0.0340
4   126.0         0.3969        0.1574     0.0005      0.0186
5   106.0         0.3815        0.1582     0.0003      0.0218
6    65.0         0.6136        0.1315     0.0013      0.0783
7    62.0         0.6301        0.1698     0.0008      0.0750
8    48.0         0.3266        0.1242     0.0003      0.0542
9    45.0         0.2920        0.1354     0.0002      0.0551
10   43.0         0.6213        0.1345     0.0009      0.0783
11   40.0         0.6046        0.1563     0.0008      0.0750
12   37.0         0.2811        0.1128     0.0003      0.0560
13   36.0         0.5604        0.1171     0.0014      0.0784
14   35.0         0.2250        0.1211     0.0002      0.0288
15   26.0         0.2636        0.1341     0.0002      0.0604
16   24.0         0.5663        0.1579     0.0037      0.0783
17   23.0         0.5213        0.1795     0.0010      0.0441
18   22.0         0.5491        0.1967     0.0010      0.0451
19   20.0         0.6115        0.1256     0.0023      0.0750
20   18.0         0.5365        0.1195     0.0008      0.0784
21   16.0         0.4459        0.1685     0.0024      0.0784
22   13.0         0.2393        0.1061     0.0003      0.0342
23   12.0         0.3573        0.1770     0.0010      0.0404
24    8.0         0.4821        0.1186     0.0007      0.0135
25    3.0         0.4592        0.0625     0.0014      0.0238
26    3.0         0.5134        0.0839     0.0016      0.0138
27    3.0         0.4321        0.1450     0.0164      0.0783
28    2.0         0.1801        0.0305     0.0385      0.0784
29    2.0         0.4558        0.0107     0.0010      0.0240
30    2.0         0.1400        0.0890     0.0040      0.0302
31    2.0         0.2187        0.1037     0.0203      0.0751
32    1.0         0.6258        0.0000     0.0010      0.0943
33    1.0         0.5209        0.0000     0.0035      0.0884
34    1.0         0.4773        0.0000     0.0016      0.0875

Local Linear Model (LLM) parallel coordinate plot

exp.model_interpret(model="ReLU-DNN", show="llm_pc", figsize=(5, 4))
Parallel Coordinate Plot of LLM Coefficients

Local Linear Model (LLM) violin plot

exp.model_interpret(model="ReLU-DNN", show="llm_violin", figsize=(5, 4))
Violin Plot of LLM Coefficients

Global feature importance

exp.model_interpret(model="ReLU-DNN", show="global_fi", figsize=(5, 4))
Feature Importance

Global effect plot with one feature

exp.model_interpret(model="ReLU-DNN", show="global_effect_plot", uni_feature="X0",
                    original_scale=True, figsize=(5, 4))
LLM Feature Importance of X0: 25.72%

Global effect plot with two features

exp.model_interpret(model="ReLU-DNN", show="global_effect_plot", bi_features=["X0", "X2"],
                    original_scale=True, figsize=(5, 4))
X0, X2

Local feature importance without centering

exp.model_interpret(model="ReLU-DNN", show="local_fi", sample_id=0, centered=False,
                    original_scale=True, figsize=(5, 4))
Predicted: 0.3369 | Actual: 0.3549

Local feature importance with centering

exp.model_interpret(model="ReLU-DNN", show="local_fi", sample_id=0, centered=True,
                    original_scale=True, figsize=(5, 4))
Predicted: 0.3369 | Actual: 0.3549

Total running time of the script: ( 2 minutes 0.526 seconds)

Estimated memory usage: 25 MB

Gallery generated by Sphinx-Gallery