Skip to content

Commit 921de4c

Browse files
committed
Update notebooks
1 parent 6f21266 commit 921de4c

12 files changed

+137032
-6188
lines changed

docs/Workshop/202206Workshop-Part1 InterpretableML_BikeSharing.ipynb

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,7 @@
667667
"source": [
668668
"import xgboost as xgb\n",
669669
"model = xgb.XGBRegressor(max_depth=7, n_estimators=500)\n",
670-
"\n",
671-
"pipeline = exp.make_pipeline(model=model, name='XGBoost')\n",
672-
"pipeline.fit()\n",
673-
"exp.register(pipeline=pipeline)"
670+
"exp.model_train(model, name=\"XGBoost\")"
674671
]
675672
},
676673
{
@@ -863,7 +860,7 @@
863860
],
864861
"source": [
865862
"# Check model performance\n",
866-
"exp.model_diagnose(model=\"XGBoost\", show='accuracy_result')"
863+
"exp.model_diagnose(model=\"XGBoost\", show='accuracy_table')"
867864
]
868865
},
869866
{
@@ -929,9 +926,9 @@
929926
"import matplotlib.pyplot as plt\n",
930927
"plt.rcParams[\"figure.figsize\"] = (6, 5)\n",
931928
"\n",
932-
"_, _, _, _, feature_names, _ = exp.get_clean_data()\n",
933-
"clf.get_booster().feature_names = feature_names\n",
934-
"xgb.plot_importance(clf, title=\"XGBoost Variable Importance\", show_values=False)\n",
929+
"feature_names = exp.get_feature_names()\n",
930+
"model.get_booster().feature_names = feature_names\n",
931+
"xgb.plot_importance(model, title=\"XGBoost Variable Importance\", show_values=False)\n",
935932
"plt.show()"
936933
]
937934
},
@@ -1308,7 +1305,7 @@
13081305
],
13091306
"source": [
13101307
"# Local - LIME\n",
1311-
"exp.model_explain(model='XGBoost', show='local_lime', sample_id=1, figsize=(6, 5))"
1308+
"exp.model_explain(model='XGBoost', show='lime', sample_id=1, figsize=(6, 5))"
13121309
]
13131310
},
13141311
{
@@ -1369,7 +1366,7 @@
13691366
],
13701367
"source": [
13711368
"# Local - SHAP (TreeSHAP)\n",
1372-
"exp.model_explain(model='XGBoost', show='local_shap', sample_id=1, figsize=(6, 5))"
1369+
"exp.model_explain(model='XGBoost', show='shap_waterfall', sample_id=1, figsize=(6, 5))"
13731370
]
13741371
},
13751372
{
@@ -3974,11 +3971,8 @@
39743971
],
39753972
"source": [
39763973
"import xgboost as xgb\n",
3977-
"clf = xgb.XGBRegressor(max_depth=7, n_estimators=500)\n",
3978-
"\n",
3979-
"pipeline = exp.make_pipeline(model=clf, name='XGBoost')\n",
3980-
"pipeline.fit()\n",
3981-
"exp.register(pipeline=pipeline)"
3974+
"model = xgb.XGBRegressor(max_depth=7, n_estimators=500)\n",
3975+
"exp.model_train(model, name='XGBoost')"
39823976
]
39833977
},
39843978
{
@@ -4156,7 +4150,7 @@
41564150
}
41574151
],
41584152
"source": [
4159-
"exp.model_compare(models=['XGBoost', 'MLP'], show='accuracy')"
4153+
"exp.model_compare(models=['XGBoost', 'MLP'], show='accuracy_plot')"
41604154
]
41614155
},
41624156
{
@@ -4250,7 +4244,7 @@
42504244
}
42514245
],
42524246
"source": [
4253-
"exp.model_compare(models=['XGBoost', 'MLP'], show='robustness')"
4247+
"exp.model_compare(models=['XGBoost', 'MLP'], show='robustness_perf')"
42544248
]
42554249
},
42564250
{
@@ -4344,7 +4338,7 @@
43444338
}
43454339
],
43464340
"source": [
4347-
"exp.model_compare(models=['XGBoost', 'MLP'], show='resilience', alpha=0.2)"
4341+
"exp.model_compare(models=['XGBoost', 'MLP'], show='resilience_perf', alpha=0.2)"
43484342
]
43494343
}
43504344
],

docs/Workshop/202206Workshop-Part2 Model_Diagnostics_BikeSharing.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,7 +2427,9 @@
24272427
"outputs": [],
24282428
"source": [
24292429
"import xgboost as xgb\n",
2430-
"exp.model_train(model=xgb.XGBRegressor(max_depth=7, n_estimators=500), name='XGBoost')"
2430+
"\n",
2431+
"model = xgb.XGBRegressor(max_depth=7, n_estimators=500)\n",
2432+
"exp.model_train(model=model, name='XGBoost')"
24312433
]
24322434
},
24332435
{
@@ -2504,9 +2506,9 @@
25042506
"import matplotlib.pyplot as plt\n",
25052507
"plt.rcParams[\"figure.figsize\"] = (6, 5)\n",
25062508
"\n",
2507-
"_, _, _, _, feature_names, _ = exp.get_clean_data()\n",
2508-
"clf.get_booster().feature_names = feature_names\n",
2509-
"xgb.plot_importance(clf, title=\"XGBoost Variable Importance\", show_values=False)\n",
2509+
"feature_names = exp.get_feature_names()\n",
2510+
"model.get_booster().feature_names = feature_names\n",
2511+
"xgb.plot_importance(model, title=\"XGBoost Variable Importance\", show_values=False)\n",
25102512
"plt.show()"
25112513
]
25122514
},

docs/Workshop/202206Workshop-Part2 Model_Diagnostics_CaliforniaHousing.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4611,7 +4611,8 @@
46114611
],
46124612
"source": [
46134613
"import xgboost as xgb\n",
4614-
"exp.model_train(model=xgb.XGBRegressor(max_depth=7, n_estimators=500), name='XGBoost')"
4614+
"model = xgb.XGBRegressor(max_depth=7, n_estimators=500)\n",
4615+
"exp.model_train(model=model, name='XGBoost')"
46154616
]
46164617
},
46174618
{
@@ -4901,9 +4902,9 @@
49014902
"import matplotlib.pyplot as plt\n",
49024903
"plt.rcParams[\"figure.figsize\"] = (6, 5)\n",
49034904
"\n",
4904-
"_, _, _, _, feature_names, _ = exp.get_clean_data()\n",
4905-
"clf.get_booster().feature_names = feature_names\n",
4906-
"xgb.plot_importance(clf, title=\"XGBoost Variable Importance\", show_values=False)\n",
4905+
"feature_names = exp.get_feature_names()\n",
4906+
"model.get_booster().feature_names = feature_names\n",
4907+
"xgb.plot_importance(model, title=\"XGBoost Variable Importance\", show_values=False)\n",
49074908
"plt.show()"
49084909
]
49094910
},

docs/Workshop/202206Workshop-Part2 Model_Diagnostics_TaiwanCredit.ipynb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,11 +2007,8 @@
20072007
],
20082008
"source": [
20092009
"import xgboost as xgb\n",
2010-
"clf = xgb.XGBClassifier(max_depth=7, n_estimators=500)\n",
2011-
"\n",
2012-
"pipeline = exp.make_pipeline(model=clf, name='XGBoost')\n",
2013-
"pipeline.fit()\n",
2014-
"exp.register(pipeline=pipeline)"
2010+
"model = xgb.XGBClassifier(max_depth=7, n_estimators=500)\n",
2011+
"exp.model_train(model, name='XGBoost')"
20152012
]
20162013
},
20172014
{

docs/Workshop/202207DemoNotebook_BikeSharing.ipynb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,11 +1282,8 @@
12821282
],
12831283
"source": [
12841284
"from xgboost import XGBRegressor\n",
1285-
"\n",
1286-
"clf = XGBRegressor(n_estimators=500, max_depth=7)\n",
1287-
"pipeline = exp.make_pipeline(clf)\n",
1288-
"pipeline.fit()\n",
1289-
"exp.register(pipeline=pipeline, name='XGBoost7')"
1285+
"model = xgb.XGBRegressor(max_depth=7, n_estimators=500)\n",
1286+
"exp.model_train(model, name='XGBoost')"
12901287
]
12911288
},
12921289
{

docs/Workshop/202207DemoNotebook_TaiwanCredit.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,10 +1379,8 @@
13791379
"source": [
13801380
"from xgboost import XGBClassifier\n",
13811381
"\n",
1382-
"clf = XGBClassifier(n_estimators=500, max_depth=5)\n",
1383-
"pipeline = exp.make_pipeline(clf)\n",
1384-
"pipeline.fit()\n",
1385-
"exp.register(pipeline=pipeline, name='XGBoost5')"
1382+
"model = XGBClassifier(n_estimators=500, max_depth=5)\n",
1383+
"exp.model_train(model, name=\"XGBoost5\")"
13861384
]
13871385
},
13881386
{

docs/Workshop/202307-ResML/20230713ResML_BikeSharing.ipynb

Lines changed: 52662 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)