noshot 0.4.1__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. noshot/data/ML TS XAI/TS/10. Seasonal ARIMA Forecasting.ipynb +32 -714
  2. noshot/data/ML TS XAI/TS/11. Multivariate ARIMA Forecasting.ipynb +29 -1071
  3. noshot/data/ML TS XAI/TS/6. ACF PACF.ipynb +7 -105
  4. noshot/data/ML TS XAI/TS/7. Differencing.ipynb +16 -152
  5. noshot/data/ML TS XAI/TS/8. ARMA Forecasting.ipynb +26 -575
  6. noshot/data/ML TS XAI/TS/9. ARIMA Forecasting.ipynb +23 -382
  7. noshot/data/ML TS XAI/XAI/XAI 1/EDA2_chipsdatset.ipynb +633 -0
  8. noshot/data/ML TS XAI/XAI/XAI 1/EDA_IRISH_8thjan.ipynb +326 -0
  9. noshot/data/ML TS XAI/XAI/XAI 1/XAI_EX1 MODEL BIAS (FINAL).ipynb +487 -0
  10. noshot/data/ML TS XAI/XAI/XAI 1/complete_guide_to_eda_on_text_data.ipynb +845 -0
  11. noshot/data/ML TS XAI/XAI/XAI 1/deepchecksframeworks.ipynb +100 -0
  12. noshot/data/ML TS XAI/XAI/XAI 1/deepexplainers (mnist).ipynb +90 -0
  13. noshot/data/ML TS XAI/XAI/XAI 1/guidedbackpropagation.ipynb +203 -0
  14. noshot/data/ML TS XAI/XAI/XAI 1/updated_image_EDA1_with_LRP.ipynb +3998 -0
  15. noshot/data/ML TS XAI/XAI/XAI 1/zebrastripes.ipynb +271 -0
  16. noshot/data/ML TS XAI/XAI/XAI 2/EXP_5.ipynb +1545 -0
  17. noshot/data/ML TS XAI/XAI/XAI 2/Exp-3 (EDA-loan).ipynb +221 -0
  18. noshot/data/ML TS XAI/XAI/XAI 2/Exp-3 (EDA-movie).ipynb +229 -0
  19. noshot/data/ML TS XAI/XAI/XAI 2/Exp-4(Flower dataset).ipynb +237 -0
  20. noshot/data/ML TS XAI/XAI/XAI 2/Exp-4.ipynb +241 -0
  21. noshot/data/ML TS XAI/XAI/XAI 2/Exp_2.ipynb +352 -0
  22. noshot/data/ML TS XAI/XAI/XAI 2/Exp_7.ipynb +110 -0
  23. noshot/data/ML TS XAI/XAI/XAI 2/FeatureImportance_SensitivityAnalysis.ipynb +708 -0
  24. {noshot-0.4.1.dist-info → noshot-1.0.0.dist-info}/METADATA +1 -1
  25. noshot-1.0.0.dist-info/RECORD +32 -0
  26. noshot-0.4.1.dist-info/RECORD +0 -15
  27. {noshot-0.4.1.dist-info → noshot-1.0.0.dist-info}/WHEEL +0 -0
  28. {noshot-0.4.1.dist-info → noshot-1.0.0.dist-info}/licenses/LICENSE.txt +0 -0
  29. {noshot-0.4.1.dist-info → noshot-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1545 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "Mrf4xROWisDL"
7
+ },
8
+ "source": [
9
+ "# **Linear shap**"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": null,
15
+ "metadata": {
16
+ "colab": {
17
+ "base_uri": "https://localhost:8080/",
18
+ "height": 223
19
+ },
20
+ "id": "4mjDHxIbZYIP",
21
+ "outputId": "8a4cff63-8cf6-43f9-db26-a73d6dda16da"
22
+ },
23
+ "outputs": [],
24
+ "source": [
25
+ "import shap\n",
26
+ "import pandas as pd\n",
27
+ "import numpy as np\n",
28
+ "import matplotlib.pyplot as plt\n",
29
+ "from sklearn.model_selection import train_test_split\n",
30
+ "from sklearn.preprocessing import StandardScaler\n",
31
+ "from sklearn.linear_model import LinearRegression\n",
32
+ "\n",
33
+ "\n",
34
+ "url = \"/content/redwine.csv\"\n",
35
+ "data = pd.read_csv(url)\n",
36
+ "\n",
37
+ "data.head()"
38
+ ]
39
+ },
40
+ {
41
+ "cell_type": "code",
42
+ "execution_count": null,
43
+ "metadata": {
44
+ "colab": {
45
+ "base_uri": "https://localhost:8080/",
46
+ "height": 80
47
+ },
48
+ "id": "qHTaD3VYZcLm",
49
+ "outputId": "3d94ea7e-7511-4345-f08e-4a2fdc7ace1a"
50
+ },
51
+ "outputs": [],
52
+ "source": [
53
+ "X = data.drop(columns=[\"quality\"])\n",
54
+ "y = data[\"quality\"]\n",
55
+ "\n",
56
+ "\n",
57
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
58
+ "\n",
59
+ "\n",
60
+ "scaler = StandardScaler()\n",
61
+ "X_train = scaler.fit_transform(X_train)\n",
62
+ "X_test = scaler.transform(X_test)\n",
63
+ "\n",
64
+ "\n",
65
+ "model = LinearRegression()\n",
66
+ "model.fit(X_train, y_train)\n",
67
+ "\n"
68
+ ]
69
+ },
70
+ {
71
+ "cell_type": "code",
72
+ "execution_count": null,
73
+ "metadata": {
74
+ "colab": {
75
+ "base_uri": "https://localhost:8080/",
76
+ "height": 1000,
77
+ "referenced_widgets": [
78
+ "e59c91f1ac42447a8d97da5cbfeaf919",
79
+ "f52afed55c5d43419f17d51c528d820a",
80
+ "956ade483238471fb4e3ab1c11e7724f",
81
+ "aa36ac3ce3354610bdc54be122e5bc4d",
82
+ "8731287981864014be1154edc0c3eba5",
83
+ "4c4e802ab50e4f408c63374ef2a29ce9",
84
+ "929cc32ff82348949fa4d36f17ffdbe0",
85
+ "90558b09f7294cd38148f483f5a87bf3",
86
+ "0d45e78edbe54459b9a59c8c11f41b2f",
87
+ "835aba7f48514c59987bc889bd587505",
88
+ "8487e3ebe34b47508dc30f747bf853a0"
89
+ ]
90
+ },
91
+ "id": "G5IWZa4CjOF4",
92
+ "outputId": "a3c86b0b-c1f2-4caa-b58d-19902968d637"
93
+ },
94
+ "outputs": [],
95
+ "source": [
96
+ "explainer = shap.LinearExplainer(model, X_train, feature_perturbation=\"correlation_dependent\") # Fixed error\n",
97
+ "\n",
98
+ "shap_values = explainer.shap_values(X_test)\n",
99
+ "\n",
100
+ "shap_df = pd.DataFrame(shap_values, columns=X.columns)\n",
101
+ "\n",
102
+ "shap.summary_plot(shap_values, X_test, feature_names=X.columns)\n",
103
+ "\n",
104
+ "shap.dependence_plot(\"alcohol\", shap_values, X_test, feature_names=X.columns)\n",
105
+ "\n",
106
+ "shap.initjs()\n",
107
+ "shap.force_plot(explainer.expected_value, shap_values[0], X_test[0], feature_names=X.columns)"
108
+ ]
109
+ },
110
+ {
111
+ "cell_type": "markdown",
112
+ "metadata": {
113
+ "id": "cykhcsaYjwui"
114
+ },
115
+ "source": [
116
+ "# **Regression shap**"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": null,
122
+ "metadata": {
123
+ "colab": {
124
+ "base_uri": "https://localhost:8080/",
125
+ "height": 223
126
+ },
127
+ "id": "wiY3u1yCj_MV",
128
+ "outputId": "e38daa5b-3c91-4da7-f355-69de02064121"
129
+ },
130
+ "outputs": [],
131
+ "source": [
132
+ "import pandas as pd\n",
133
+ "import seaborn as sns\n",
134
+ "import matplotlib.pyplot as plt\n",
135
+ "from sklearn.model_selection import train_test_split\n",
136
+ "from sklearn.ensemble import RandomForestRegressor\n",
137
+ "import shap\n",
138
+ "\n",
139
+ "\n",
140
+ "url = \"/content/redwine.csv\"\n",
141
+ "data = pd.read_csv(url)\n",
142
+ "\n",
143
+ "data.head()"
144
+ ]
145
+ },
146
+ {
147
+ "cell_type": "code",
148
+ "execution_count": null,
149
+ "metadata": {
150
+ "colab": {
151
+ "base_uri": "https://localhost:8080/",
152
+ "height": 506
153
+ },
154
+ "id": "cD9YhFB0Zclh",
155
+ "outputId": "318d1262-6ee9-4355-9d58-a3521d7ee313"
156
+ },
157
+ "outputs": [],
158
+ "source": [
159
+ "sns.displot(\n",
160
+ " data=data.isna().melt(value_name=\"missing\"),\n",
161
+ " y=\"variable\",\n",
162
+ " hue=\"missing\",\n",
163
+ " multiple=\"fill\",\n",
164
+ " aspect=1.5\n",
165
+ ")\n",
166
+ "plt.show()"
167
+ ]
168
+ },
169
+ {
170
+ "cell_type": "code",
171
+ "execution_count": null,
172
+ "metadata": {
173
+ "colab": {
174
+ "base_uri": "https://localhost:8080/",
175
+ "height": 80
176
+ },
177
+ "id": "NM1ddyLRZc6V",
178
+ "outputId": "5843b853-2fd7-486a-94b7-efbce2eb3d42"
179
+ },
180
+ "outputs": [],
181
+ "source": [
182
+ "from sklearn.model_selection import train_test_split\n",
183
+ "features = data.drop(columns=['quality'])\n",
184
+ "labels = data['quality']\n",
185
+ "x_train, x_test, y_train, y_test = train_test_split(features, labels, test_size=0.2, random_state=123)\n",
186
+ "\n",
187
+ "from sklearn.ensemble import RandomForestRegressor\n",
188
+ "model = RandomForestRegressor(n_estimators=2000, max_depth=30, random_state=123)\n",
189
+ "model.fit(x_train, y_train)\n"
190
+ ]
191
+ },
192
+ {
193
+ "cell_type": "code",
194
+ "execution_count": null,
195
+ "metadata": {
196
+ "colab": {
197
+ "base_uri": "https://localhost:8080/"
198
+ },
199
+ "id": "B7M2D8VnkKRB",
200
+ "outputId": "6c8d027c-03c1-49b3-c9f9-b8eeb43a7a40"
201
+ },
202
+ "outputs": [],
203
+ "source": [
204
+ "model.score(x_test, y_test)"
205
+ ]
206
+ },
207
+ {
208
+ "cell_type": "code",
209
+ "execution_count": null,
210
+ "metadata": {
211
+ "colab": {
212
+ "base_uri": "https://localhost:8080/",
213
+ "height": 646
214
+ },
215
+ "id": "fE-8PW0ekNjv",
216
+ "outputId": "9ded61ba-2f75-4cbf-c868-d2443763d39d"
217
+ },
218
+ "outputs": [],
219
+ "source": [
220
+ "explainer = shap.Explainer(model)\n",
221
+ "shap_values = explainer(x_test)\n",
222
+ "plt.title('Feature Importance using SHAP')\n",
223
+ "shap.plots.bar(shap_values, show=True, max_display=12)"
224
+ ]
225
+ },
226
+ {
227
+ "cell_type": "code",
228
+ "execution_count": null,
229
+ "metadata": {
230
+ "colab": {
231
+ "base_uri": "https://localhost:8080/",
232
+ "height": 564
233
+ },
234
+ "id": "g9gH-OWXkQcE",
235
+ "outputId": "35552661-954a-4821-cca6-7cb6d32c6d9d"
236
+ },
237
+ "outputs": [],
238
+ "source": [
239
+ "expected_value = explainer.expected_value\n",
240
+ "shap_values = explainer.shap_values(x_test)[0]\n",
241
+ "shap.decision_plot(expected_value, shap_values, x_test)"
242
+ ]
243
+ },
244
+ {
245
+ "cell_type": "markdown",
246
+ "metadata": {
247
+ "id": "yvqqrtknzDch"
248
+ },
249
+ "source": [
250
+ "# **Tree Shap - German dataset**"
251
+ ]
252
+ },
253
+ {
254
+ "cell_type": "code",
255
+ "execution_count": null,
256
+ "metadata": {
257
+ "colab": {
258
+ "base_uri": "https://localhost:8080/"
259
+ },
260
+ "id": "Kb59xrmbyiQh",
261
+ "outputId": "85486766-feb3-4573-9172-213638321e33"
262
+ },
263
+ "outputs": [],
264
+ "source": [
265
+ "!pip install --upgrade numpy pandas matplotlib seaborn sklearn lightgbm shap"
266
+ ]
267
+ },
268
+ {
269
+ "cell_type": "code",
270
+ "execution_count": null,
271
+ "metadata": {
272
+ "colab": {
273
+ "base_uri": "https://localhost:8080/",
274
+ "height": 60
275
+ },
276
+ "id": "AUHlRFpWZdJZ",
277
+ "outputId": "6f3b5abb-5ba4-4105-8379-b07ef420536a"
278
+ },
279
+ "outputs": [],
280
+ "source": [
281
+ "import warnings\n",
282
+ "import numpy as np\n",
283
+ "import pandas as pd\n",
284
+ "import seaborn as sns\n",
285
+ "import matplotlib.pyplot as plt\n",
286
+ "import sklearn\n",
287
+ "from sklearn.model_selection import train_test_split\n",
288
+ "from sklearn.metrics import accuracy_score,confusion_matrix,roc_auc_score\n",
289
+ "from sklearn.preprocessing import LabelEncoder\n",
290
+ "import lightgbm as lgb\n",
291
+ "import shap\n",
292
+ "\n",
293
+ "print(f\"Shap version used: {shap.__version__}\")\n",
294
+ "\n",
295
+ "shap.initjs()"
296
+ ]
297
+ },
298
+ {
299
+ "cell_type": "code",
300
+ "execution_count": null,
301
+ "metadata": {
302
+ "colab": {
303
+ "base_uri": "https://localhost:8080/",
304
+ "height": 206
305
+ },
306
+ "id": "W-JO-ZGmZdhI",
307
+ "outputId": "f7811a6a-76fe-4835-b60f-0f6fb26ccc6a"
308
+ },
309
+ "outputs": [],
310
+ "source": [
311
+ "data = pd.read_csv('/content/german_credit_data.csv', index_col=0)\n",
312
+ "data.head()"
313
+ ]
314
+ },
315
+ {
316
+ "cell_type": "code",
317
+ "execution_count": null,
318
+ "metadata": {
319
+ "colab": {
320
+ "base_uri": "https://localhost:8080/"
321
+ },
322
+ "id": "NM3Md3cQkyVC",
323
+ "outputId": "f6a0221e-5198-4ef3-cc13-2f56f1a18903"
324
+ },
325
+ "outputs": [],
326
+ "source": [
327
+ "data.shape"
328
+ ]
329
+ },
330
+ {
331
+ "cell_type": "code",
332
+ "execution_count": null,
333
+ "metadata": {
334
+ "colab": {
335
+ "base_uri": "https://localhost:8080/"
336
+ },
337
+ "id": "9abnjoQSkzof",
338
+ "outputId": "7f9672f1-fb82-4db8-8e1f-9d2150982429"
339
+ },
340
+ "outputs": [],
341
+ "source": [
342
+ "data.columns"
343
+ ]
344
+ },
345
+ {
346
+ "cell_type": "code",
347
+ "execution_count": null,
348
+ "metadata": {
349
+ "colab": {
350
+ "base_uri": "https://localhost:8080/"
351
+ },
352
+ "id": "CfLRp87Bk0rK",
353
+ "outputId": "d062abe5-399a-421b-b37d-c0b1ece11f03"
354
+ },
355
+ "outputs": [],
356
+ "source": [
357
+ "data.info()"
358
+ ]
359
+ },
360
+ {
361
+ "cell_type": "code",
362
+ "execution_count": null,
363
+ "metadata": {
364
+ "colab": {
365
+ "base_uri": "https://localhost:8080/",
366
+ "height": 300
367
+ },
368
+ "id": "Jj8rySKdkwtt",
369
+ "outputId": "602f1f3e-67c6-455c-86ad-b1a0c71d1b9f"
370
+ },
371
+ "outputs": [],
372
+ "source": [
373
+ "num_features = ['Age', 'Credit amount', 'Duration']\n",
374
+ "cat_features = ['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose']\n",
375
+ "\n",
376
+ "data[num_features].describe()"
377
+ ]
378
+ },
379
+ {
380
+ "cell_type": "code",
381
+ "execution_count": null,
382
+ "metadata": {
383
+ "colab": {
384
+ "base_uri": "https://localhost:8080/",
385
+ "height": 506
386
+ },
387
+ "id": "OokZhe1GZhFm",
388
+ "outputId": "d790f610-e7b6-428c-c6d9-5fcf270fc178"
389
+ },
390
+ "outputs": [],
391
+ "source": [
392
+ "sns.displot(\n",
393
+ " data=data.isna().melt(value_name=\"missing\"),\n",
394
+ " y=\"variable\",\n",
395
+ " hue=\"missing\",\n",
396
+ " multiple=\"fill\",\n",
397
+ " aspect=1.5,\n",
398
+ " palette='seismic'\n",
399
+ ")\n",
400
+ "plt.show()"
401
+ ]
402
+ },
403
+ {
404
+ "cell_type": "code",
405
+ "execution_count": null,
406
+ "metadata": {
407
+ "colab": {
408
+ "base_uri": "https://localhost:8080/",
409
+ "height": 146
410
+ },
411
+ "id": "5T4RmXblZz2d",
412
+ "outputId": "db009db1-03f7-42af-f56a-a344ae1375d3"
413
+ },
414
+ "outputs": [],
415
+ "source": [
416
+ "missing_features = ['Saving accounts','Checking account']\n",
417
+ "data[missing_features].isna().sum()/1000*100"
418
+ ]
419
+ },
420
+ {
421
+ "cell_type": "code",
422
+ "execution_count": null,
423
+ "metadata": {
424
+ "colab": {
425
+ "base_uri": "https://localhost:8080/"
426
+ },
427
+ "id": "IX3lGsFPZ0hR",
428
+ "outputId": "86609d7c-d3dd-4d63-8b0a-3c620e7deec5"
429
+ },
430
+ "outputs": [],
431
+ "source": [
432
+ "data.fillna('Unknown', inplace=True)\n",
433
+ "\n",
434
+ "print(data[missing_features].isna().sum()/1000 * 100)\n",
435
+ "print(data[missing_features[0]].value_counts())\n",
436
+ "print(data[missing_features[1]].value_counts())"
437
+ ]
438
+ },
439
+ {
440
+ "cell_type": "code",
441
+ "execution_count": null,
442
+ "metadata": {
443
+ "colab": {
444
+ "base_uri": "https://localhost:8080/"
445
+ },
446
+ "id": "t_jamAltlKf8",
447
+ "outputId": "8a0ad824-d661-4077-873c-328d0b088f28"
448
+ },
449
+ "outputs": [],
450
+ "source": [
451
+ "data.duplicated().any()"
452
+ ]
453
+ },
454
+ {
455
+ "cell_type": "code",
456
+ "execution_count": null,
457
+ "metadata": {
458
+ "colab": {
459
+ "base_uri": "https://localhost:8080/",
460
+ "height": 223
461
+ },
462
+ "id": "aK0LIl2OZ7bN",
463
+ "outputId": "96346265-d720-49ec-bd12-dc0d0f623dae"
464
+ },
465
+ "outputs": [],
466
+ "source": [
467
+ "le = LabelEncoder()\n",
468
+ "for feat in ['Sex','Saving accounts','Checking account','Purpose','Risk','Housing']:\n",
469
+ " le.fit(data[feat])\n",
470
+ " data[feat]=le.transform(data[feat])\n",
471
+ "classes = list(le.classes_)\n",
472
+ "print(classes)\n",
473
+ "data.head()"
474
+ ]
475
+ },
476
+ {
477
+ "cell_type": "code",
478
+ "execution_count": null,
479
+ "metadata": {
480
+ "colab": {
481
+ "base_uri": "https://localhost:8080/"
482
+ },
483
+ "id": "ZN4x8UVNZ8sY",
484
+ "outputId": "e14007e0-9955-4d7d-b07a-565060c54748"
485
+ },
486
+ "outputs": [],
487
+ "source": [
488
+ "features = data.drop(columns=['Risk'])\n",
489
+ "labels = data['Risk']\n",
490
+ "\n",
491
+ "x_train, x_test, y_train, y_test = train_test_split(features, labels, test_size=0.2, random_state=123)\n",
492
+ "\n",
493
+ "x_train.columns\n"
494
+ ]
495
+ },
496
+ {
497
+ "cell_type": "code",
498
+ "execution_count": null,
499
+ "metadata": {
500
+ "id": "9Ndo2n3ilrBK"
501
+ },
502
+ "outputs": [],
503
+ "source": [
504
+ "data_train = lgb.Dataset(x_train, label=y_train, categorical_feature=['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose'])\n",
505
+ "data_test = lgb.Dataset(x_test, label=y_test, categorical_feature=['Sex', 'Job', 'Housing', 'Saving accounts', 'Checking account', 'Purpose'])\n",
506
+ "\n",
507
+ "params = {\n",
508
+ " 'boosting_type':'gbdt',\n",
509
+ " 'objective':'binary',\n",
510
+ " 'metric':'auc',\n",
511
+ " 'num_leaves':20,\n",
512
+ " 'learning_rate':0.05,\n",
513
+ " 'feature_fraction':0.9,\n",
514
+ " 'bagging_fraction':0.8,\n",
515
+ " 'bagging_freq':5,\n",
516
+ " 'verbose':-1,\n",
517
+ " 'lambda_l1':1,\n",
518
+ " 'lambda_l2':1,\n",
519
+ " 'seed':123\n",
520
+ "}\n",
521
+ "\n",
522
+ "model = lgb.train(\n",
523
+ "params,\n",
524
+ "data_train,\n",
525
+ "num_boost_round=100,\n",
526
+ "valid_sets=[data_test,data_train]\n",
527
+ ")"
528
+ ]
529
+ },
530
+ {
531
+ "cell_type": "code",
532
+ "execution_count": null,
533
+ "metadata": {
534
+ "colab": {
535
+ "base_uri": "https://localhost:8080/"
536
+ },
537
+ "id": "LSdon-0GZ8ZS",
538
+ "outputId": "244b56f0-5b4d-4a30-cb99-c43144dc751b"
539
+ },
540
+ "outputs": [],
541
+ "source": [
542
+ "y_pred = model.predict(x_test)\n",
543
+ "y_pred = [1 if y > 0.5 else 0 for y in y_pred]\n",
544
+ "\n",
545
+ "print(f'Accuracy for the baseline model is: {accuracy_score(y_test, y_pred)}')\n"
546
+ ]
547
+ },
548
+ {
549
+ "cell_type": "code",
550
+ "execution_count": null,
551
+ "metadata": {
552
+ "colab": {
553
+ "base_uri": "https://localhost:8080/"
554
+ },
555
+ "id": "fpcoFyJpmv6x",
556
+ "outputId": "922ddd1c-df15-4c85-9443-e54f826c115f"
557
+ },
558
+ "outputs": [],
559
+ "source": [
560
+ "explainer = shap.TreeExplainer(model)\n",
561
+ "shap_values = explainer.shap_values(features)"
562
+ ]
563
+ },
564
+ {
565
+ "cell_type": "code",
566
+ "execution_count": null,
567
+ "metadata": {
568
+ "colab": {
569
+ "base_uri": "https://localhost:8080/",
570
+ "height": 516
571
+ },
572
+ "id": "RoSi7wnKm1ig",
573
+ "outputId": "e9c8f232-913f-4a7a-b2ed-77fb1904ce31"
574
+ },
575
+ "outputs": [],
576
+ "source": [
577
+ "shap.summary_plot(shap_values, features)"
578
+ ]
579
+ },
580
+ {
581
+ "cell_type": "code",
582
+ "execution_count": null,
583
+ "metadata": {
584
+ "colab": {
585
+ "base_uri": "https://localhost:8080/",
586
+ "height": 69
587
+ },
588
+ "id": "ty9FAZWqnD9-",
589
+ "outputId": "420a7b9c-8c4d-4da1-d26d-04ef7bde0983"
590
+ },
591
+ "outputs": [],
592
+ "source": [
593
+ "shap.force_plot(explainer.expected_value, shap_values[0], features.iloc[0,:]) # Corrected index to 0"
594
+ ]
595
+ },
596
+ {
597
+ "cell_type": "code",
598
+ "execution_count": null,
599
+ "metadata": {
600
+ "colab": {
601
+ "base_uri": "https://localhost:8080/",
602
+ "height": 502
603
+ },
604
+ "id": "hvwf_kdDnVxh",
605
+ "outputId": "f3896849-fc5b-48d2-977d-7ecb0ffeb867"
606
+ },
607
+ "outputs": [],
608
+ "source": [
609
+ "shap.decision_plot(explainer.expected_value, shap_values[0], features.iloc[0,:])"
610
+ ]
611
+ },
612
+ {
613
+ "cell_type": "code",
614
+ "execution_count": null,
615
+ "metadata": {
616
+ "colab": {
617
+ "base_uri": "https://localhost:8080/",
618
+ "height": 1000
619
+ },
620
+ "id": "xF-xZfkInncT",
621
+ "outputId": "ed168984-42f5-4f15-a37c-77cb9526ddc9"
622
+ },
623
+ "outputs": [],
624
+ "source": [
625
+ "for col in ['Sex','Housing','Checking account','Saving accounts','Purpose','Credit amount','Age']:\n",
626
+ " print(f'Feature Dependence plot for:{col}')\n",
627
+ " shap.dependence_plot(col, shap_values, features, display_features=features)"
628
+ ]
629
+ },
630
+ {
631
+ "cell_type": "markdown",
632
+ "metadata": {
633
+ "id": "I52D9qOSn-HA"
634
+ },
635
+ "source": [
636
+ "# **Deep shap**"
637
+ ]
638
+ },
639
+ {
640
+ "cell_type": "code",
641
+ "execution_count": null,
642
+ "metadata": {
643
+ "colab": {
644
+ "base_uri": "https://localhost:8080/"
645
+ },
646
+ "id": "vaFPLrm4Z8QB",
647
+ "outputId": "c94ddaf4-58ec-489c-9734-1e97d70af477"
648
+ },
649
+ "outputs": [],
650
+ "source": [
651
+ "import tensorflow as tf\n",
652
+ "import numpy as np\n",
653
+ "import matplotlib.pyplot as plt\n",
654
+ "from tensorflow.keras.datasets import mnist\n",
655
+ "from tensorflow.keras.models import Sequential\n",
656
+ "from tensorflow.keras.layers import Dense, Flatten\n",
657
+ "\n",
658
+ "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
659
+ "\n",
660
+ "x_train, x_test = x_train / 255.0, x_test / 255.0\n",
661
+ "\n",
662
+ "model = Sequential([\n",
663
+ " Flatten(input_shape=(28, 28)),\n",
664
+ " Dense(128, activation='relu'),\n",
665
+ " Dense(10, activation='softmax')\n",
666
+ "])"
667
+ ]
668
+ },
669
+ {
670
+ "cell_type": "code",
671
+ "execution_count": null,
672
+ "metadata": {
673
+ "colab": {
674
+ "base_uri": "https://localhost:8080/",
675
+ "height": 1000
676
+ },
677
+ "id": "QypN7qjZZ8GG",
678
+ "outputId": "f6c36853-220c-4778-ccc0-ffba4766bc0e"
679
+ },
680
+ "outputs": [],
681
+ "source": [
682
+ "model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])\n",
683
+ "model.fit(x_train, y_train, epochs=3, batch_size=128, validation_data=(x_test, y_test))\n",
684
+ "background = x_train[np.random.choice(x_train.shape[0], 100, replace=False)]\n",
685
+ "\n",
686
+ "explainer = shap.DeepExplainer(model, background)\n",
687
+ "X_test_sample = x_test[:10]\n",
688
+ "shap_values = explainer.shap_values(X_test_sample)\n",
689
+ "\n",
690
+ "plt.figure(figsize=(8, 4))\n",
691
+ "shap.image_plot(shap_values, X_test_sample)"
692
+ ]
693
+ },
694
+ {
695
+ "cell_type": "markdown",
696
+ "metadata": {
697
+ "id": "-eEdltzyohUf"
698
+ },
699
+ "source": [
700
+ "# **Kernal shap**"
701
+ ]
702
+ },
703
+ {
704
+ "cell_type": "code",
705
+ "execution_count": null,
706
+ "metadata": {
707
+ "id": "8rFdoi4f2BRq"
708
+ },
709
+ "outputs": [],
710
+ "source": [
711
+ "!pip install shap scikit-learn matplotlib"
712
+ ]
713
+ },
714
+ {
715
+ "cell_type": "code",
716
+ "execution_count": null,
717
+ "metadata": {
718
+ "id": "tAlO1p9ComgL"
719
+ },
720
+ "outputs": [],
721
+ "source": [
722
+ "import shap\n",
723
+ "import numpy as np\n",
724
+ "import matplotlib.pyplot as plt\n",
725
+ "from sklearn.ensemble import RandomForestClassifier\n",
726
+ "from sklearn.datasets import load_iris\n",
727
+ "from sklearn.model_selection import train_test_split"
728
+ ]
729
+ },
730
+ {
731
+ "cell_type": "code",
732
+ "execution_count": null,
733
+ "metadata": {
734
+ "id": "xaLCP9u_Z78X"
735
+ },
736
+ "outputs": [],
737
+ "source": [
738
+ "data = load_iris()\n",
739
+ "x = data.data\n",
740
+ "y = data.target\n",
741
+ "feature_names = data.feature_names\n",
742
+ "\n",
743
+ "x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=42)"
744
+ ]
745
+ },
746
+ {
747
+ "cell_type": "code",
748
+ "execution_count": null,
749
+ "metadata": {
750
+ "colab": {
751
+ "base_uri": "https://localhost:8080/",
752
+ "height": 80
753
+ },
754
+ "id": "PQGek2frZ7vO",
755
+ "outputId": "5e5e264a-3a81-4667-b49d-7ddfbb4e39e3"
756
+ },
757
+ "outputs": [],
758
+ "source": [
759
+ "model = RandomForestClassifier(random_state=42)\n",
760
+ "model.fit(x_train,y_train)"
761
+ ]
762
+ },
763
+ {
764
+ "cell_type": "code",
765
+ "execution_count": null,
766
+ "metadata": {
767
+ "colab": {
768
+ "base_uri": "https://localhost:8080/",
769
+ "height": 385,
770
+ "referenced_widgets": [
771
+ "473cc3c759cb4f0ab855237f752f98e4",
772
+ "8dae60a073264505829bda0463a1031c",
773
+ "b1ebcb257d0f42ec9e3d454417929286",
774
+ "4960679a5325442f8dc47dd06e9cd44c",
775
+ "260f50e7bad6461aba0971d9c62749db",
776
+ "31b769c507784bdf9aac5924f8d6b9f3",
777
+ "a65165ff50aa42be99a80c42eaf2312e",
778
+ "46de81bdeb5447f9a5943befddeba2db",
779
+ "0dc92e0e7c224848aba6de391ed981e5",
780
+ "2ad24f377bb0433fb90477dc185e2343",
781
+ "9e14d8d91a6f431aa7cad57703cac706"
782
+ ]
783
+ },
784
+ "id": "1L8bMp1zoz7Q",
785
+ "outputId": "b7060f22-16aa-42a3-8284-7f806e70f72d"
786
+ },
787
+ "outputs": [],
788
+ "source": [
789
+ "explainer = shap.KernelExplainer(model.predict, x_train)\n",
790
+ "\n",
791
+ "shap_values = explainer.shap_values(x_test[:5])\n",
792
+ "\n",
793
+ "shap.summary_plot(shap_values, x_test[:5], feature_names=feature_names)"
794
+ ]
795
+ },
796
+ {
797
+ "cell_type": "code",
798
+ "execution_count": null,
799
+ "metadata": {
800
+ "colab": {
801
+ "base_uri": "https://localhost:8080/",
802
+ "height": 43
803
+ },
804
+ "id": "Y7gh21m44NDC",
805
+ "outputId": "2005ab47-e8e5-4390-9722-ba221d2e7299"
806
+ },
807
+ "outputs": [],
808
+ "source": [
809
+ "shap.initjs()"
810
+ ]
811
+ },
812
+ {
813
+ "cell_type": "code",
814
+ "execution_count": null,
815
+ "metadata": {
816
+ "id": "EIuK2GwasApq"
817
+ },
818
+ "outputs": [],
819
+ "source": [
820
+ "#shap.force_plot(explainer.expected_value, shap_values[0][0], x_test[0], feature_names=feature_names)\n"
821
+ ]
822
+ },
823
+ {
824
+ "cell_type": "code",
825
+ "execution_count": null,
826
+ "metadata": {
827
+ "id": "tl0eLEv2tme9"
828
+ },
829
+ "outputs": [],
830
+ "source": []
831
+ }
832
+ ],
833
+ "metadata": {
834
+ "colab": {
835
+ "provenance": []
836
+ },
837
+ "kernelspec": {
838
+ "display_name": "Python 3 (ipykernel)",
839
+ "language": "python",
840
+ "name": "python3"
841
+ },
842
+ "language_info": {
843
+ "codemirror_mode": {
844
+ "name": "ipython",
845
+ "version": 3
846
+ },
847
+ "file_extension": ".py",
848
+ "mimetype": "text/x-python",
849
+ "name": "python",
850
+ "nbconvert_exporter": "python",
851
+ "pygments_lexer": "ipython3",
852
+ "version": "3.12.4"
853
+ },
854
+ "widgets": {
855
+ "application/vnd.jupyter.widget-state+json": {
856
+ "0d45e78edbe54459b9a59c8c11f41b2f": {
857
+ "model_module": "@jupyter-widgets/controls",
858
+ "model_module_version": "1.5.0",
859
+ "model_name": "ProgressStyleModel",
860
+ "state": {
861
+ "_model_module": "@jupyter-widgets/controls",
862
+ "_model_module_version": "1.5.0",
863
+ "_model_name": "ProgressStyleModel",
864
+ "_view_count": null,
865
+ "_view_module": "@jupyter-widgets/base",
866
+ "_view_module_version": "1.2.0",
867
+ "_view_name": "StyleView",
868
+ "bar_color": null,
869
+ "description_width": ""
870
+ }
871
+ },
872
+ "0dc92e0e7c224848aba6de391ed981e5": {
873
+ "model_module": "@jupyter-widgets/controls",
874
+ "model_module_version": "1.5.0",
875
+ "model_name": "ProgressStyleModel",
876
+ "state": {
877
+ "_model_module": "@jupyter-widgets/controls",
878
+ "_model_module_version": "1.5.0",
879
+ "_model_name": "ProgressStyleModel",
880
+ "_view_count": null,
881
+ "_view_module": "@jupyter-widgets/base",
882
+ "_view_module_version": "1.2.0",
883
+ "_view_name": "StyleView",
884
+ "bar_color": null,
885
+ "description_width": ""
886
+ }
887
+ },
888
+ "260f50e7bad6461aba0971d9c62749db": {
889
+ "model_module": "@jupyter-widgets/base",
890
+ "model_module_version": "1.2.0",
891
+ "model_name": "LayoutModel",
892
+ "state": {
893
+ "_model_module": "@jupyter-widgets/base",
894
+ "_model_module_version": "1.2.0",
895
+ "_model_name": "LayoutModel",
896
+ "_view_count": null,
897
+ "_view_module": "@jupyter-widgets/base",
898
+ "_view_module_version": "1.2.0",
899
+ "_view_name": "LayoutView",
900
+ "align_content": null,
901
+ "align_items": null,
902
+ "align_self": null,
903
+ "border": null,
904
+ "bottom": null,
905
+ "display": null,
906
+ "flex": null,
907
+ "flex_flow": null,
908
+ "grid_area": null,
909
+ "grid_auto_columns": null,
910
+ "grid_auto_flow": null,
911
+ "grid_auto_rows": null,
912
+ "grid_column": null,
913
+ "grid_gap": null,
914
+ "grid_row": null,
915
+ "grid_template_areas": null,
916
+ "grid_template_columns": null,
917
+ "grid_template_rows": null,
918
+ "height": null,
919
+ "justify_content": null,
920
+ "justify_items": null,
921
+ "left": null,
922
+ "margin": null,
923
+ "max_height": null,
924
+ "max_width": null,
925
+ "min_height": null,
926
+ "min_width": null,
927
+ "object_fit": null,
928
+ "object_position": null,
929
+ "order": null,
930
+ "overflow": null,
931
+ "overflow_x": null,
932
+ "overflow_y": null,
933
+ "padding": null,
934
+ "right": null,
935
+ "top": null,
936
+ "visibility": null,
937
+ "width": null
938
+ }
939
+ },
940
+ "2ad24f377bb0433fb90477dc185e2343": {
941
+ "model_module": "@jupyter-widgets/base",
942
+ "model_module_version": "1.2.0",
943
+ "model_name": "LayoutModel",
944
+ "state": {
945
+ "_model_module": "@jupyter-widgets/base",
946
+ "_model_module_version": "1.2.0",
947
+ "_model_name": "LayoutModel",
948
+ "_view_count": null,
949
+ "_view_module": "@jupyter-widgets/base",
950
+ "_view_module_version": "1.2.0",
951
+ "_view_name": "LayoutView",
952
+ "align_content": null,
953
+ "align_items": null,
954
+ "align_self": null,
955
+ "border": null,
956
+ "bottom": null,
957
+ "display": null,
958
+ "flex": null,
959
+ "flex_flow": null,
960
+ "grid_area": null,
961
+ "grid_auto_columns": null,
962
+ "grid_auto_flow": null,
963
+ "grid_auto_rows": null,
964
+ "grid_column": null,
965
+ "grid_gap": null,
966
+ "grid_row": null,
967
+ "grid_template_areas": null,
968
+ "grid_template_columns": null,
969
+ "grid_template_rows": null,
970
+ "height": null,
971
+ "justify_content": null,
972
+ "justify_items": null,
973
+ "left": null,
974
+ "margin": null,
975
+ "max_height": null,
976
+ "max_width": null,
977
+ "min_height": null,
978
+ "min_width": null,
979
+ "object_fit": null,
980
+ "object_position": null,
981
+ "order": null,
982
+ "overflow": null,
983
+ "overflow_x": null,
984
+ "overflow_y": null,
985
+ "padding": null,
986
+ "right": null,
987
+ "top": null,
988
+ "visibility": null,
989
+ "width": null
990
+ }
991
+ },
992
+ "31b769c507784bdf9aac5924f8d6b9f3": {
993
+ "model_module": "@jupyter-widgets/base",
994
+ "model_module_version": "1.2.0",
995
+ "model_name": "LayoutModel",
996
+ "state": {
997
+ "_model_module": "@jupyter-widgets/base",
998
+ "_model_module_version": "1.2.0",
999
+ "_model_name": "LayoutModel",
1000
+ "_view_count": null,
1001
+ "_view_module": "@jupyter-widgets/base",
1002
+ "_view_module_version": "1.2.0",
1003
+ "_view_name": "LayoutView",
1004
+ "align_content": null,
1005
+ "align_items": null,
1006
+ "align_self": null,
1007
+ "border": null,
1008
+ "bottom": null,
1009
+ "display": null,
1010
+ "flex": null,
1011
+ "flex_flow": null,
1012
+ "grid_area": null,
1013
+ "grid_auto_columns": null,
1014
+ "grid_auto_flow": null,
1015
+ "grid_auto_rows": null,
1016
+ "grid_column": null,
1017
+ "grid_gap": null,
1018
+ "grid_row": null,
1019
+ "grid_template_areas": null,
1020
+ "grid_template_columns": null,
1021
+ "grid_template_rows": null,
1022
+ "height": null,
1023
+ "justify_content": null,
1024
+ "justify_items": null,
1025
+ "left": null,
1026
+ "margin": null,
1027
+ "max_height": null,
1028
+ "max_width": null,
1029
+ "min_height": null,
1030
+ "min_width": null,
1031
+ "object_fit": null,
1032
+ "object_position": null,
1033
+ "order": null,
1034
+ "overflow": null,
1035
+ "overflow_x": null,
1036
+ "overflow_y": null,
1037
+ "padding": null,
1038
+ "right": null,
1039
+ "top": null,
1040
+ "visibility": null,
1041
+ "width": null
1042
+ }
1043
+ },
1044
+ "46de81bdeb5447f9a5943befddeba2db": {
1045
+ "model_module": "@jupyter-widgets/base",
1046
+ "model_module_version": "1.2.0",
1047
+ "model_name": "LayoutModel",
1048
+ "state": {
1049
+ "_model_module": "@jupyter-widgets/base",
1050
+ "_model_module_version": "1.2.0",
1051
+ "_model_name": "LayoutModel",
1052
+ "_view_count": null,
1053
+ "_view_module": "@jupyter-widgets/base",
1054
+ "_view_module_version": "1.2.0",
1055
+ "_view_name": "LayoutView",
1056
+ "align_content": null,
1057
+ "align_items": null,
1058
+ "align_self": null,
1059
+ "border": null,
1060
+ "bottom": null,
1061
+ "display": null,
1062
+ "flex": null,
1063
+ "flex_flow": null,
1064
+ "grid_area": null,
1065
+ "grid_auto_columns": null,
1066
+ "grid_auto_flow": null,
1067
+ "grid_auto_rows": null,
1068
+ "grid_column": null,
1069
+ "grid_gap": null,
1070
+ "grid_row": null,
1071
+ "grid_template_areas": null,
1072
+ "grid_template_columns": null,
1073
+ "grid_template_rows": null,
1074
+ "height": null,
1075
+ "justify_content": null,
1076
+ "justify_items": null,
1077
+ "left": null,
1078
+ "margin": null,
1079
+ "max_height": null,
1080
+ "max_width": null,
1081
+ "min_height": null,
1082
+ "min_width": null,
1083
+ "object_fit": null,
1084
+ "object_position": null,
1085
+ "order": null,
1086
+ "overflow": null,
1087
+ "overflow_x": null,
1088
+ "overflow_y": null,
1089
+ "padding": null,
1090
+ "right": null,
1091
+ "top": null,
1092
+ "visibility": null,
1093
+ "width": null
1094
+ }
1095
+ },
1096
+ "473cc3c759cb4f0ab855237f752f98e4": {
1097
+ "model_module": "@jupyter-widgets/controls",
1098
+ "model_module_version": "1.5.0",
1099
+ "model_name": "HBoxModel",
1100
+ "state": {
1101
+ "_dom_classes": [],
1102
+ "_model_module": "@jupyter-widgets/controls",
1103
+ "_model_module_version": "1.5.0",
1104
+ "_model_name": "HBoxModel",
1105
+ "_view_count": null,
1106
+ "_view_module": "@jupyter-widgets/controls",
1107
+ "_view_module_version": "1.5.0",
1108
+ "_view_name": "HBoxView",
1109
+ "box_style": "",
1110
+ "children": [
1111
+ "IPY_MODEL_8dae60a073264505829bda0463a1031c",
1112
+ "IPY_MODEL_b1ebcb257d0f42ec9e3d454417929286",
1113
+ "IPY_MODEL_4960679a5325442f8dc47dd06e9cd44c"
1114
+ ],
1115
+ "layout": "IPY_MODEL_260f50e7bad6461aba0971d9c62749db"
1116
+ }
1117
+ },
1118
+ "4960679a5325442f8dc47dd06e9cd44c": {
1119
+ "model_module": "@jupyter-widgets/controls",
1120
+ "model_module_version": "1.5.0",
1121
+ "model_name": "HTMLModel",
1122
+ "state": {
1123
+ "_dom_classes": [],
1124
+ "_model_module": "@jupyter-widgets/controls",
1125
+ "_model_module_version": "1.5.0",
1126
+ "_model_name": "HTMLModel",
1127
+ "_view_count": null,
1128
+ "_view_module": "@jupyter-widgets/controls",
1129
+ "_view_module_version": "1.5.0",
1130
+ "_view_name": "HTMLView",
1131
+ "description": "",
1132
+ "description_tooltip": null,
1133
+ "layout": "IPY_MODEL_2ad24f377bb0433fb90477dc185e2343",
1134
+ "placeholder": "​",
1135
+ "style": "IPY_MODEL_9e14d8d91a6f431aa7cad57703cac706",
1136
+ "value": " 5/5 [00:00<00:00, 19.95it/s]"
1137
+ }
1138
+ },
1139
+ "4c4e802ab50e4f408c63374ef2a29ce9": {
1140
+ "model_module": "@jupyter-widgets/base",
1141
+ "model_module_version": "1.2.0",
1142
+ "model_name": "LayoutModel",
1143
+ "state": {
1144
+ "_model_module": "@jupyter-widgets/base",
1145
+ "_model_module_version": "1.2.0",
1146
+ "_model_name": "LayoutModel",
1147
+ "_view_count": null,
1148
+ "_view_module": "@jupyter-widgets/base",
1149
+ "_view_module_version": "1.2.0",
1150
+ "_view_name": "LayoutView",
1151
+ "align_content": null,
1152
+ "align_items": null,
1153
+ "align_self": null,
1154
+ "border": null,
1155
+ "bottom": null,
1156
+ "display": null,
1157
+ "flex": null,
1158
+ "flex_flow": null,
1159
+ "grid_area": null,
1160
+ "grid_auto_columns": null,
1161
+ "grid_auto_flow": null,
1162
+ "grid_auto_rows": null,
1163
+ "grid_column": null,
1164
+ "grid_gap": null,
1165
+ "grid_row": null,
1166
+ "grid_template_areas": null,
1167
+ "grid_template_columns": null,
1168
+ "grid_template_rows": null,
1169
+ "height": null,
1170
+ "justify_content": null,
1171
+ "justify_items": null,
1172
+ "left": null,
1173
+ "margin": null,
1174
+ "max_height": null,
1175
+ "max_width": null,
1176
+ "min_height": null,
1177
+ "min_width": null,
1178
+ "object_fit": null,
1179
+ "object_position": null,
1180
+ "order": null,
1181
+ "overflow": null,
1182
+ "overflow_x": null,
1183
+ "overflow_y": null,
1184
+ "padding": null,
1185
+ "right": null,
1186
+ "top": null,
1187
+ "visibility": null,
1188
+ "width": null
1189
+ }
1190
+ },
1191
+ "835aba7f48514c59987bc889bd587505": {
1192
+ "model_module": "@jupyter-widgets/base",
1193
+ "model_module_version": "1.2.0",
1194
+ "model_name": "LayoutModel",
1195
+ "state": {
1196
+ "_model_module": "@jupyter-widgets/base",
1197
+ "_model_module_version": "1.2.0",
1198
+ "_model_name": "LayoutModel",
1199
+ "_view_count": null,
1200
+ "_view_module": "@jupyter-widgets/base",
1201
+ "_view_module_version": "1.2.0",
1202
+ "_view_name": "LayoutView",
1203
+ "align_content": null,
1204
+ "align_items": null,
1205
+ "align_self": null,
1206
+ "border": null,
1207
+ "bottom": null,
1208
+ "display": null,
1209
+ "flex": null,
1210
+ "flex_flow": null,
1211
+ "grid_area": null,
1212
+ "grid_auto_columns": null,
1213
+ "grid_auto_flow": null,
1214
+ "grid_auto_rows": null,
1215
+ "grid_column": null,
1216
+ "grid_gap": null,
1217
+ "grid_row": null,
1218
+ "grid_template_areas": null,
1219
+ "grid_template_columns": null,
1220
+ "grid_template_rows": null,
1221
+ "height": null,
1222
+ "justify_content": null,
1223
+ "justify_items": null,
1224
+ "left": null,
1225
+ "margin": null,
1226
+ "max_height": null,
1227
+ "max_width": null,
1228
+ "min_height": null,
1229
+ "min_width": null,
1230
+ "object_fit": null,
1231
+ "object_position": null,
1232
+ "order": null,
1233
+ "overflow": null,
1234
+ "overflow_x": null,
1235
+ "overflow_y": null,
1236
+ "padding": null,
1237
+ "right": null,
1238
+ "top": null,
1239
+ "visibility": null,
1240
+ "width": null
1241
+ }
1242
+ },
1243
+ "8487e3ebe34b47508dc30f747bf853a0": {
1244
+ "model_module": "@jupyter-widgets/controls",
1245
+ "model_module_version": "1.5.0",
1246
+ "model_name": "DescriptionStyleModel",
1247
+ "state": {
1248
+ "_model_module": "@jupyter-widgets/controls",
1249
+ "_model_module_version": "1.5.0",
1250
+ "_model_name": "DescriptionStyleModel",
1251
+ "_view_count": null,
1252
+ "_view_module": "@jupyter-widgets/base",
1253
+ "_view_module_version": "1.2.0",
1254
+ "_view_name": "StyleView",
1255
+ "description_width": ""
1256
+ }
1257
+ },
1258
+ "8731287981864014be1154edc0c3eba5": {
1259
+ "model_module": "@jupyter-widgets/base",
1260
+ "model_module_version": "1.2.0",
1261
+ "model_name": "LayoutModel",
1262
+ "state": {
1263
+ "_model_module": "@jupyter-widgets/base",
1264
+ "_model_module_version": "1.2.0",
1265
+ "_model_name": "LayoutModel",
1266
+ "_view_count": null,
1267
+ "_view_module": "@jupyter-widgets/base",
1268
+ "_view_module_version": "1.2.0",
1269
+ "_view_name": "LayoutView",
1270
+ "align_content": null,
1271
+ "align_items": null,
1272
+ "align_self": null,
1273
+ "border": null,
1274
+ "bottom": null,
1275
+ "display": null,
1276
+ "flex": null,
1277
+ "flex_flow": null,
1278
+ "grid_area": null,
1279
+ "grid_auto_columns": null,
1280
+ "grid_auto_flow": null,
1281
+ "grid_auto_rows": null,
1282
+ "grid_column": null,
1283
+ "grid_gap": null,
1284
+ "grid_row": null,
1285
+ "grid_template_areas": null,
1286
+ "grid_template_columns": null,
1287
+ "grid_template_rows": null,
1288
+ "height": null,
1289
+ "justify_content": null,
1290
+ "justify_items": null,
1291
+ "left": null,
1292
+ "margin": null,
1293
+ "max_height": null,
1294
+ "max_width": null,
1295
+ "min_height": null,
1296
+ "min_width": null,
1297
+ "object_fit": null,
1298
+ "object_position": null,
1299
+ "order": null,
1300
+ "overflow": null,
1301
+ "overflow_x": null,
1302
+ "overflow_y": null,
1303
+ "padding": null,
1304
+ "right": null,
1305
+ "top": null,
1306
+ "visibility": null,
1307
+ "width": null
1308
+ }
1309
+ },
1310
+ "8dae60a073264505829bda0463a1031c": {
1311
+ "model_module": "@jupyter-widgets/controls",
1312
+ "model_module_version": "1.5.0",
1313
+ "model_name": "HTMLModel",
1314
+ "state": {
1315
+ "_dom_classes": [],
1316
+ "_model_module": "@jupyter-widgets/controls",
1317
+ "_model_module_version": "1.5.0",
1318
+ "_model_name": "HTMLModel",
1319
+ "_view_count": null,
1320
+ "_view_module": "@jupyter-widgets/controls",
1321
+ "_view_module_version": "1.5.0",
1322
+ "_view_name": "HTMLView",
1323
+ "description": "",
1324
+ "description_tooltip": null,
1325
+ "layout": "IPY_MODEL_31b769c507784bdf9aac5924f8d6b9f3",
1326
+ "placeholder": "​",
1327
+ "style": "IPY_MODEL_a65165ff50aa42be99a80c42eaf2312e",
1328
+ "value": "100%"
1329
+ }
1330
+ },
1331
+ "90558b09f7294cd38148f483f5a87bf3": {
1332
+ "model_module": "@jupyter-widgets/base",
1333
+ "model_module_version": "1.2.0",
1334
+ "model_name": "LayoutModel",
1335
+ "state": {
1336
+ "_model_module": "@jupyter-widgets/base",
1337
+ "_model_module_version": "1.2.0",
1338
+ "_model_name": "LayoutModel",
1339
+ "_view_count": null,
1340
+ "_view_module": "@jupyter-widgets/base",
1341
+ "_view_module_version": "1.2.0",
1342
+ "_view_name": "LayoutView",
1343
+ "align_content": null,
1344
+ "align_items": null,
1345
+ "align_self": null,
1346
+ "border": null,
1347
+ "bottom": null,
1348
+ "display": null,
1349
+ "flex": null,
1350
+ "flex_flow": null,
1351
+ "grid_area": null,
1352
+ "grid_auto_columns": null,
1353
+ "grid_auto_flow": null,
1354
+ "grid_auto_rows": null,
1355
+ "grid_column": null,
1356
+ "grid_gap": null,
1357
+ "grid_row": null,
1358
+ "grid_template_areas": null,
1359
+ "grid_template_columns": null,
1360
+ "grid_template_rows": null,
1361
+ "height": null,
1362
+ "justify_content": null,
1363
+ "justify_items": null,
1364
+ "left": null,
1365
+ "margin": null,
1366
+ "max_height": null,
1367
+ "max_width": null,
1368
+ "min_height": null,
1369
+ "min_width": null,
1370
+ "object_fit": null,
1371
+ "object_position": null,
1372
+ "order": null,
1373
+ "overflow": null,
1374
+ "overflow_x": null,
1375
+ "overflow_y": null,
1376
+ "padding": null,
1377
+ "right": null,
1378
+ "top": null,
1379
+ "visibility": null,
1380
+ "width": null
1381
+ }
1382
+ },
1383
+ "929cc32ff82348949fa4d36f17ffdbe0": {
1384
+ "model_module": "@jupyter-widgets/controls",
1385
+ "model_module_version": "1.5.0",
1386
+ "model_name": "DescriptionStyleModel",
1387
+ "state": {
1388
+ "_model_module": "@jupyter-widgets/controls",
1389
+ "_model_module_version": "1.5.0",
1390
+ "_model_name": "DescriptionStyleModel",
1391
+ "_view_count": null,
1392
+ "_view_module": "@jupyter-widgets/base",
1393
+ "_view_module_version": "1.2.0",
1394
+ "_view_name": "StyleView",
1395
+ "description_width": ""
1396
+ }
1397
+ },
1398
+ "956ade483238471fb4e3ab1c11e7724f": {
1399
+ "model_module": "@jupyter-widgets/controls",
1400
+ "model_module_version": "1.5.0",
1401
+ "model_name": "FloatProgressModel",
1402
+ "state": {
1403
+ "_dom_classes": [],
1404
+ "_model_module": "@jupyter-widgets/controls",
1405
+ "_model_module_version": "1.5.0",
1406
+ "_model_name": "FloatProgressModel",
1407
+ "_view_count": null,
1408
+ "_view_module": "@jupyter-widgets/controls",
1409
+ "_view_module_version": "1.5.0",
1410
+ "_view_name": "ProgressView",
1411
+ "bar_style": "success",
1412
+ "description": "",
1413
+ "description_tooltip": null,
1414
+ "layout": "IPY_MODEL_90558b09f7294cd38148f483f5a87bf3",
1415
+ "max": 1000,
1416
+ "min": 0,
1417
+ "orientation": "horizontal",
1418
+ "style": "IPY_MODEL_0d45e78edbe54459b9a59c8c11f41b2f",
1419
+ "value": 1000
1420
+ }
1421
+ },
1422
+ "9e14d8d91a6f431aa7cad57703cac706": {
1423
+ "model_module": "@jupyter-widgets/controls",
1424
+ "model_module_version": "1.5.0",
1425
+ "model_name": "DescriptionStyleModel",
1426
+ "state": {
1427
+ "_model_module": "@jupyter-widgets/controls",
1428
+ "_model_module_version": "1.5.0",
1429
+ "_model_name": "DescriptionStyleModel",
1430
+ "_view_count": null,
1431
+ "_view_module": "@jupyter-widgets/base",
1432
+ "_view_module_version": "1.2.0",
1433
+ "_view_name": "StyleView",
1434
+ "description_width": ""
1435
+ }
1436
+ },
1437
+ "a65165ff50aa42be99a80c42eaf2312e": {
1438
+ "model_module": "@jupyter-widgets/controls",
1439
+ "model_module_version": "1.5.0",
1440
+ "model_name": "DescriptionStyleModel",
1441
+ "state": {
1442
+ "_model_module": "@jupyter-widgets/controls",
1443
+ "_model_module_version": "1.5.0",
1444
+ "_model_name": "DescriptionStyleModel",
1445
+ "_view_count": null,
1446
+ "_view_module": "@jupyter-widgets/base",
1447
+ "_view_module_version": "1.2.0",
1448
+ "_view_name": "StyleView",
1449
+ "description_width": ""
1450
+ }
1451
+ },
1452
+ "aa36ac3ce3354610bdc54be122e5bc4d": {
1453
+ "model_module": "@jupyter-widgets/controls",
1454
+ "model_module_version": "1.5.0",
1455
+ "model_name": "HTMLModel",
1456
+ "state": {
1457
+ "_dom_classes": [],
1458
+ "_model_module": "@jupyter-widgets/controls",
1459
+ "_model_module_version": "1.5.0",
1460
+ "_model_name": "HTMLModel",
1461
+ "_view_count": null,
1462
+ "_view_module": "@jupyter-widgets/controls",
1463
+ "_view_module_version": "1.5.0",
1464
+ "_view_name": "HTMLView",
1465
+ "description": "",
1466
+ "description_tooltip": null,
1467
+ "layout": "IPY_MODEL_835aba7f48514c59987bc889bd587505",
1468
+ "placeholder": "​",
1469
+ "style": "IPY_MODEL_8487e3ebe34b47508dc30f747bf853a0",
1470
+ "value": " 1000/1000 [00:00<00:00, 1327.59it/s]"
1471
+ }
1472
+ },
1473
+ "b1ebcb257d0f42ec9e3d454417929286": {
1474
+ "model_module": "@jupyter-widgets/controls",
1475
+ "model_module_version": "1.5.0",
1476
+ "model_name": "FloatProgressModel",
1477
+ "state": {
1478
+ "_dom_classes": [],
1479
+ "_model_module": "@jupyter-widgets/controls",
1480
+ "_model_module_version": "1.5.0",
1481
+ "_model_name": "FloatProgressModel",
1482
+ "_view_count": null,
1483
+ "_view_module": "@jupyter-widgets/controls",
1484
+ "_view_module_version": "1.5.0",
1485
+ "_view_name": "ProgressView",
1486
+ "bar_style": "success",
1487
+ "description": "",
1488
+ "description_tooltip": null,
1489
+ "layout": "IPY_MODEL_46de81bdeb5447f9a5943befddeba2db",
1490
+ "max": 5,
1491
+ "min": 0,
1492
+ "orientation": "horizontal",
1493
+ "style": "IPY_MODEL_0dc92e0e7c224848aba6de391ed981e5",
1494
+ "value": 5
1495
+ }
1496
+ },
1497
+ "e59c91f1ac42447a8d97da5cbfeaf919": {
1498
+ "model_module": "@jupyter-widgets/controls",
1499
+ "model_module_version": "1.5.0",
1500
+ "model_name": "HBoxModel",
1501
+ "state": {
1502
+ "_dom_classes": [],
1503
+ "_model_module": "@jupyter-widgets/controls",
1504
+ "_model_module_version": "1.5.0",
1505
+ "_model_name": "HBoxModel",
1506
+ "_view_count": null,
1507
+ "_view_module": "@jupyter-widgets/controls",
1508
+ "_view_module_version": "1.5.0",
1509
+ "_view_name": "HBoxView",
1510
+ "box_style": "",
1511
+ "children": [
1512
+ "IPY_MODEL_f52afed55c5d43419f17d51c528d820a",
1513
+ "IPY_MODEL_956ade483238471fb4e3ab1c11e7724f",
1514
+ "IPY_MODEL_aa36ac3ce3354610bdc54be122e5bc4d"
1515
+ ],
1516
+ "layout": "IPY_MODEL_8731287981864014be1154edc0c3eba5"
1517
+ }
1518
+ },
1519
+ "f52afed55c5d43419f17d51c528d820a": {
1520
+ "model_module": "@jupyter-widgets/controls",
1521
+ "model_module_version": "1.5.0",
1522
+ "model_name": "HTMLModel",
1523
+ "state": {
1524
+ "_dom_classes": [],
1525
+ "_model_module": "@jupyter-widgets/controls",
1526
+ "_model_module_version": "1.5.0",
1527
+ "_model_name": "HTMLModel",
1528
+ "_view_count": null,
1529
+ "_view_module": "@jupyter-widgets/controls",
1530
+ "_view_module_version": "1.5.0",
1531
+ "_view_name": "HTMLView",
1532
+ "description": "",
1533
+ "description_tooltip": null,
1534
+ "layout": "IPY_MODEL_4c4e802ab50e4f408c63374ef2a29ce9",
1535
+ "placeholder": "​",
1536
+ "style": "IPY_MODEL_929cc32ff82348949fa4d36f17ffdbe0",
1537
+ "value": "Estimating transforms: 100%"
1538
+ }
1539
+ }
1540
+ }
1541
+ }
1542
+ },
1543
+ "nbformat": 4,
1544
+ "nbformat_minor": 4
1545
+ }