Skip to content

Commit 95b4121

Browse files
committed
Merge remote-tracking branch 'upstream/main' into time-series-examples
2 parents 0437826 + 3066071 commit 95b4121

File tree

9 files changed

+94
-95
lines changed

9 files changed

+94
-95
lines changed

.github/workflows/notebooks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Execute Jupyter Notebooks
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.ipynb'
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: [3.8, 3.9]
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install JRE
25+
run: sudo apt-get update && sudo apt-get install -y default-jre
26+
27+
- name: Install Jupyter
28+
run: pip install jupyter
29+
30+
- name: Install TrustyAI
31+
run: pip install trustyai trustyai[extras]
32+
33+
34+
- name: Install nbconvert
35+
run: pip install nbconvert
36+
37+
- name: Execute notebooks
38+
run: |
39+
for notebook in $(find . -name '*.ipynb'); do
40+
jupyter nbconvert --execute $notebook --to notebook --inplace
41+
done

examples/Counterfactuals.ipynb

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,10 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"id": "4f81fa10",
77
"metadata": {},
8-
"outputs": [
9-
{
10-
"name": "stdout",
11-
"output_type": "stream",
12-
"text": [
13-
"\n",
14-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n",
15-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
16-
"Note: you may need to restart the kernel to use updated packages.\n"
17-
]
18-
}
19-
],
8+
"outputs": [],
209
"source": [
2110
"%pip install -r ../requirements-examples.txt --quiet"
2211
]
@@ -2033,9 +2022,6 @@
20332022
"execution_count": 35,
20342023
"id": "6c1cdfbb",
20352024
"metadata": {
2036-
"jupyter": {
2037-
"outputs_hidden": false
2038-
},
20392025
"pycharm": {
20402026
"name": "#%%\n"
20412027
}
@@ -2052,9 +2038,6 @@
20522038
"execution_count": 36,
20532039
"id": "165992c8",
20542040
"metadata": {
2055-
"jupyter": {
2056-
"outputs_hidden": false
2057-
},
20582041
"pycharm": {
20592042
"name": "#%%\n"
20602043
}
@@ -2096,9 +2079,6 @@
20962079
"execution_count": 37,
20972080
"id": "728100bc",
20982081
"metadata": {
2099-
"jupyter": {
2100-
"outputs_hidden": false
2101-
},
21022082
"pycharm": {
21032083
"name": "#%%\n"
21042084
}
@@ -2142,9 +2122,6 @@
21422122
"execution_count": 38,
21432123
"id": "e0a0b2cd",
21442124
"metadata": {
2145-
"jupyter": {
2146-
"outputs_hidden": false
2147-
},
21482125
"pycharm": {
21492126
"name": "#%%\n"
21502127
}
@@ -2176,9 +2153,6 @@
21762153
"execution_count": 39,
21772154
"id": "cba7660b",
21782155
"metadata": {
2179-
"jupyter": {
2180-
"outputs_hidden": false
2181-
},
21822156
"pycharm": {
21832157
"name": "#%%\n"
21842158
}
@@ -2218,9 +2192,6 @@
22182192
"execution_count": 40,
22192193
"id": "bb391a92",
22202194
"metadata": {
2221-
"jupyter": {
2222-
"outputs_hidden": false
2223-
},
22242195
"pycharm": {
22252196
"name": "#%%\n"
22262197
}
@@ -2250,9 +2221,6 @@
22502221
"execution_count": 41,
22512222
"id": "b21e4832",
22522223
"metadata": {
2253-
"jupyter": {
2254-
"outputs_hidden": false
2255-
},
22562224
"pycharm": {
22572225
"name": "#%%\n"
22582226
}
@@ -2293,9 +2261,6 @@
22932261
"execution_count": 42,
22942262
"id": "51dfe14f",
22952263
"metadata": {
2296-
"jupyter": {
2297-
"outputs_hidden": false
2298-
},
22992264
"pycharm": {
23002265
"name": "#%%\n"
23012266
}
@@ -2326,9 +2291,6 @@
23262291
"execution_count": 43,
23272292
"id": "4c4bad16",
23282293
"metadata": {
2329-
"jupyter": {
2330-
"outputs_hidden": false
2331-
},
23322294
"pycharm": {
23332295
"name": "#%%\n"
23342296
}
@@ -2355,9 +2317,6 @@
23552317
"execution_count": 44,
23562318
"id": "2d296529",
23572319
"metadata": {
2358-
"jupyter": {
2359-
"outputs_hidden": false
2360-
},
23612320
"pycharm": {
23622321
"name": "#%%\n"
23632322
}
@@ -2396,9 +2355,6 @@
23962355
"execution_count": 45,
23972356
"id": "01b856cb",
23982357
"metadata": {
2399-
"jupyter": {
2400-
"outputs_hidden": false
2401-
},
24022358
"pycharm": {
24032359
"name": "#%%\n"
24042360
}
@@ -2436,9 +2392,6 @@
24362392
"execution_count": 46,
24372393
"id": "d3fd6862",
24382394
"metadata": {
2439-
"jupyter": {
2440-
"outputs_hidden": false
2441-
},
24422395
"pycharm": {
24432396
"name": "#%%\n"
24442397
}

examples/Lime.ipynb

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,15 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
6-
"id": "7cab43eb",
7-
"metadata": {},
8-
"outputs": [
9-
{
10-
"name": "stdout",
11-
"output_type": "stream",
12-
"text": [
13-
"\n",
14-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n",
15-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
16-
"Note: you may need to restart the kernel to use updated packages.\n"
17-
]
18-
}
19-
],
5+
"execution_count": null,
6+
"outputs": [],
207
"source": [
218
"%pip install -r ../requirements-examples.txt --quiet"
22-
]
9+
],
10+
"metadata": {
11+
"collapsed": false
12+
},
13+
"id": "7cab43eb"
2314
},
2415
{
2516
"cell_type": "markdown",

examples/PDP.ipynb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,10 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": null,
66
"id": "230ce0fb",
77
"metadata": {},
8-
"outputs": [
9-
{
10-
"name": "stdout",
11-
"output_type": "stream",
12-
"text": [
13-
"\n",
14-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n",
15-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
16-
"Note: you may need to restart the kernel to use updated packages.\n"
17-
]
18-
}
19-
],
8+
"outputs": [],
209
"source": [
2110
"%pip install -r ../requirements-examples.txt --quiet"
2211
]

examples/SHAP.ipynb

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,10 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 1,
13+
"execution_count": null,
1414
"id": "192b323c",
1515
"metadata": {},
16-
"outputs": [
17-
{
18-
"name": "stdout",
19-
"output_type": "stream",
20-
"text": [
21-
"\n",
22-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n",
23-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
24-
"Note: you may need to restart the kernel to use updated packages.\n"
25-
]
26-
}
27-
],
16+
"outputs": [],
2817
"source": [
2918
"from trustyai.utils import TestModels\n",
3019
"from trustyai.model import feature, output, Model, Dataset\n",

examples/TSICE.ipynb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,21 @@
2020
"id": "3f02eae5-f871-457a-9750-526581319e8b",
2121
"metadata": {},
2222
"source": [
23-
"<a id='imports'></a>\n",
2423
"### Imports"
2524
]
2625
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": null,
29+
"outputs": [],
30+
"source": [
31+
"%pip install -r ../requirements-examples.txt --quiet"
32+
],
33+
"metadata": {
34+
"collapsed": false
35+
},
36+
"id": "5fb65e97bbebff9a"
37+
},
2738
{
2839
"cell_type": "code",
2940
"execution_count": 1,

examples/TSLime.ipynb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525
"The example model is a pre-trained keras model and hosted on huggingface hub. So, this notebook requires to install tensorflow 2.4+ and huggingface_hub packages."
2626
]
2727
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": null,
31+
"outputs": [],
32+
"source": [
33+
"%pip install -r ../requirements-examples.txt --quiet"
34+
],
35+
"metadata": {
36+
"collapsed": false
37+
},
38+
"id": "b7b41b9eb1a6c3a1"
39+
},
2840
{
2941
"cell_type": "code",
3042
"execution_count": 1,
@@ -550,9 +562,9 @@
550562
],
551563
"metadata": {
552564
"kernelspec": {
553-
"name": "trustyai-explainability-python-examples",
565+
"name": "python3",
554566
"language": "python",
555-
"display_name": "trustyai-explainability-python-examples"
567+
"display_name": "Python 3"
556568
},
557569
"language_info": {
558570
"codemirror_mode": {

examples/TSSaliency.ipynb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@
2424
"The example model is a pre-trained keras model and hosted on huggingface hub. So, this notebook requires to install tensorflow 2.4+ and huggingface_hub packages."
2525
]
2626
},
27+
{
28+
"cell_type": "code",
29+
"execution_count": null,
30+
"outputs": [],
31+
"source": [
32+
"%pip install -r ../requirements-examples.txt --quiet"
33+
],
34+
"metadata": {
35+
"collapsed": false
36+
},
37+
"id": "82e190cfe952ae16"
38+
},
2739
{
2840
"cell_type": "code",
2941
"execution_count": 1,

requirements-examples.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ xgboost==1.4.2
55
matplotlib~=3.6.3
66
tensorflow
77
keras
8-
huggingface-hub
8+
huggingface-hub
9+
trustyai[extras]

0 commit comments

Comments
 (0)