From 4f213ea19c97b66f29745213febe7f27346a576f Mon Sep 17 00:00:00 2001 From: Ritunjai-Sharma <48599782+Ritunjai-Sharma@users.noreply.github.com> Date: Thu, 26 Mar 2026 10:04:17 +0000 Subject: [PATCH 1/4] Upgraded instances of black package in the repo to 26.3.1 and above --- .pre-commit-config.yaml | 2 +- docs/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab88e07..b7272a1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,4 +28,4 @@ repos: - id: blacken-docs args: [--skip-errors] additional_dependencies: - - black==22.12.0 \ No newline at end of file + - black==26.3.1 \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 936e6fa..2b22866 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -9,7 +9,7 @@ pytest-benchmark bandit>=1.7.0 hypothesis==6.53.0 mypy==0.971 -black==22.3.0 +black>=26.3.1 flake8==5.0.4 pluggy==1.0.0 pre-commit==2.15.0 From ee1dd3606757aca37ac65a7cc8e678cfbd44ee12 Mon Sep 17 00:00:00 2001 From: Ritunjai-Sharma <48599782+Ritunjai-Sharma@users.noreply.github.com> Date: Thu, 26 Mar 2026 13:01:57 +0000 Subject: [PATCH 2/4] Remove 3.9 from repo and use 3.10 instead --- .github/workflows/python-package.yml | 4 ++-- .readthedocs.yaml | 2 +- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6517e66..84b1569 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -19,7 +19,7 @@ jobs: runs-on: "ubuntu-22.04" strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12"] steps: @@ -54,7 +54,7 @@ jobs: runs-on: "ubuntu-22.04" strategy: matrix: - python-version: ["3.9"] + python-version: ["3.10"] steps: - uses: actions/checkout@v3 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 0254c69..a36a807 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -6,7 +6,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.9" + python: "3.10" sphinx: configuration: docs/source/conf.py diff --git a/pyproject.toml b/pyproject.toml index 9ddba81..3909440 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ authors = [ {name = "LV GI Data Science Team", email = "#DataSciencePackages@lv.co.uk"}, ] description = "this package contains functionality for reporting on how your ML model is making decisions" -requires-python = ">= 3.9" +requires-python = ">= 3.10" dynamic = ["version"] dependencies = [ From e3432a8c74343263ed72a4133d10d575a654e13d Mon Sep 17 00:00:00 2001 From: Ritunjai-Sharma <48599782+Ritunjai-Sharma@users.noreply.github.com> Date: Thu, 26 Mar 2026 13:09:49 +0000 Subject: [PATCH 3/4] Re-ran example notebooks using python 3.10 --- .../Random_Forest/binary_classification.ipynb | 458 ++++++++++++++++- .../multiclass_classification.ipynb | 460 +++++++++++++++++- examples/XGB/example.ipynb | 48 +- examples/XGB/example_ohe.ipynb | 116 +++-- examples/non_standard_model.ipynb | 6 +- 5 files changed, 988 insertions(+), 100 deletions(-) diff --git a/examples/Random_Forest/binary_classification.ipynb b/examples/Random_Forest/binary_classification.ipynb index b9e41d3..dde8d76 100644 --- a/examples/Random_Forest/binary_classification.ipynb +++ b/examples/Random_Forest/binary_classification.ipynb @@ -23,7 +23,16 @@ "start_time": "2024-04-08T15:45:24.273058Z" } }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/vscode/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + } + ], "source": [ "from sklearn.ensemble import RandomForestClassifier\n", "from sklearn.datasets import make_classification\n", @@ -82,7 +91,411 @@ { "data": { "text/html": [ - "
RandomForestClassifier(max_depth=2, random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "
RandomForestClassifier(max_depth=2, random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" ], "text/plain": [ "RandomForestClassifier(max_depth=2, random_state=0)" @@ -177,7 +590,18 @@ "start_time": "2024-04-08T15:45:26.372037Z" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "single_model_contribution.fit(clf)" ] @@ -239,7 +663,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': -0.349129583}, {'Name': 'feature1', 'Value': -0.0039231513}, {'Name': 'feature4', 'Value': 0.0031653932}, {'Name': 'feature3', 'Value': 0.0013787609}]\n" + "[{'Name': 'feature2', 'Value': -0.3491295830480707}, {'Name': 'feature1', 'Value': -0.0039231513013799}, {'Name': 'feature4', 'Value': 0.0031653931724603}, {'Name': 'feature3', 'Value': 0.0013787609499949}]\n" ] } ], @@ -264,7 +688,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'feature2': (-1.2990134593088984, -0.34912958304807074)}, {'feature1': (-1.6685316675305422, -0.0039231513013799485)}, {'feature4': (-0.6036204360190907, 0.0031653931724603453)}, {'feature3': (0.27464720361244455, 0.0013787609499948776)}]\n" + "[{'feature2': (np.float64(-1.2990134593088984), -0.3491295830480707)}, {'feature1': (np.float64(-1.6685316675305422), -0.0039231513013799)}, {'feature4': (np.float64(-0.6036204360190907), 0.0031653931724603)}, {'feature3': (np.float64(0.27464720361244455), 0.0013787609499949)}]\n" ] } ], @@ -296,7 +720,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 was mapped', 'Value': -0.349129583}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653932}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609}]\n" + "[{'Name': 'feature 2 was mapped', 'Value': -0.3491295830480707}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513013799}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653931724603}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609499949}]\n" ] } ], @@ -335,7 +759,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 and 3 was mapped', 'Value': -0.3477508221}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653932}]\n" + "[{'Name': 'feature 2 and 3 was mapped', 'Value': -0.3477508220980758}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513013799}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653931724603}]\n" ] } ], @@ -381,7 +805,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 was mapped', 'Value': -0.349129583}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653932}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609}]\n" + "[{'Name': 'feature 2 was mapped', 'Value': -0.3491295830480707}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513013799}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653931724603}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609499949}]\n" ] } ], @@ -406,7 +830,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 4 was mapped', 'Value': 0.0031653932}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513}, {'Name': 'feature 2 was mapped', 'Value': -0.349129583}]\n" + "[{'Name': 'feature 4 was mapped', 'Value': 0.0031653931724603}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609499949}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513013799}, {'Name': 'feature 2 was mapped', 'Value': -0.3491295830480707}]\n" ] } ], @@ -431,7 +855,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 was mapped', 'Value': -0.349129583}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653932}]\n" + "[{'Name': 'feature 2 was mapped', 'Value': -0.3491295830480707}, {'Name': 'feature 1 was mapped', 'Value': -0.0039231513013799}, {'Name': 'feature 3 was mapped', 'Value': 0.0013787609499949}, {'Name': 'feature 4 was mapped', 'Value': 0.0031653931724603}]\n" ] } ], @@ -463,7 +887,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'feature 2 was mapped': -0.34912958304807074, 'feature 1 was mapped': -0.0039231513013799485, 'feature 4 was mapped': 0.0031653931724603453, 'feature 3 was mapped': 0.0013787609499948776}\n" + "{'feature 2 was mapped': -0.3491295830480707, 'feature 1 was mapped': -0.0039231513013799, 'feature 4 was mapped': 0.0031653931724603, 'feature 3 was mapped': 0.0013787609499949}\n" ] } ], @@ -488,7 +912,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[('feature 2 was mapped', -0.34912958304807074), ('feature 1 was mapped', -0.0039231513013799485), ('feature 4 was mapped', 0.0031653931724603453), ('feature 3 was mapped', 0.0013787609499948776)]\n" + "[('feature 2 was mapped', -0.3491295830480707), ('feature 1 was mapped', -0.0039231513013799), ('feature 4 was mapped', 0.0031653931724603), ('feature 3 was mapped', 0.0013787609499949)]\n" ] } ], @@ -527,7 +951,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': -0.349129583}, {'Name': 'feature1', 'Value': -0.0039231513}, {'Name': 'feature4', 'Value': 0.0031653932}, {'Name': 'feature3', 'Value': 0.0013787609}]\n" + "[{'Name': 'feature2', 'Value': -0.3491295830480707}, {'Name': 'feature1', 'Value': -0.0039231513013799}, {'Name': 'feature4', 'Value': 0.0031653931724603}, {'Name': 'feature3', 'Value': 0.0013787609499949}]\n" ] } ], @@ -555,7 +979,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': 0.349129583}, {'Name': 'feature1', 'Value': 0.0039231513}, {'Name': 'feature4', 'Value': -0.0031653932}, {'Name': 'feature3', 'Value': -0.0013787609}]\n" + "[{'Name': 'feature2', 'Value': 0.3491295830480705}, {'Name': 'feature1', 'Value': 0.00392315130138}, {'Name': 'feature4', 'Value': -0.0031653931724603}, {'Name': 'feature3', 'Value': -0.0013787609499949}]\n" ] } ], @@ -572,9 +996,9 @@ ], "metadata": { "kernelspec": { - "display_name": "model_interpreter", + "display_name": "Python 3", "language": "python", - "name": "model_interpreter" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -586,7 +1010,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.12" }, "toc": { "base_numbering": 1, diff --git a/examples/Random_Forest/multiclass_classification.ipynb b/examples/Random_Forest/multiclass_classification.ipynb index fa99746..f6fc4d1 100644 --- a/examples/Random_Forest/multiclass_classification.ipynb +++ b/examples/Random_Forest/multiclass_classification.ipynb @@ -23,7 +23,16 @@ "start_time": "2024-04-08T15:45:47.437814Z" } }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/vscode/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + } + ], "source": [ "from sklearn.ensemble import RandomForestClassifier\n", "from sklearn.datasets import make_classification\n", @@ -83,7 +92,411 @@ { "data": { "text/html": [ - "
RandomForestClassifier(max_depth=2, random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "
RandomForestClassifier(max_depth=2, random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" ], "text/plain": [ "RandomForestClassifier(max_depth=2, random_state=0)" @@ -179,7 +592,18 @@ "start_time": "2024-04-08T15:45:49.506215Z" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "single_model_contribution.fit(clf)" ] @@ -239,7 +663,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': -0.1429039852}, {'Name': 'feature1', 'Value': -0.0829521535}, {'Name': 'feature3', 'Value': 0.0016372141}, {'Name': 'feature4', 'Value': -0.0013906329}]\n" + "[{'Name': 'feature2', 'Value': -0.1429039851636571}, {'Name': 'feature1', 'Value': -0.0829521534581615}, {'Name': 'feature3', 'Value': 0.0016372141388453}, {'Name': 'feature4', 'Value': -0.0013906329471721}]\n" ] } ], @@ -271,7 +695,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': -0.1429039852}, {'Name': 'feature1', 'Value': -0.0829521535}, {'Name': 'feature3', 'Value': 0.0016372141}, {'Name': 'feature4', 'Value': -0.0013906329}]\n" + "[{'Name': 'feature2', 'Value': -0.1429039851636571}, {'Name': 'feature1', 'Value': -0.0829521534581615}, {'Name': 'feature3', 'Value': 0.0016372141388453}, {'Name': 'feature4', 'Value': -0.0013906329471721}]\n" ] } ], @@ -303,7 +727,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 was mapped', 'Value': -0.1429039852}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521535}, {'Name': 'feature 3 was mapped', 'Value': 0.0016372141}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329}]\n" + "[{'Name': 'feature 2 was mapped', 'Value': -0.1429039851636571}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521534581615}, {'Name': 'feature 3 was mapped', 'Value': 0.0016372141388453}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329471721}]\n" ] } ], @@ -342,7 +766,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 and 3 was mapped', 'Value': -0.141266771}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521535}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329}]\n" + "[{'Name': 'feature 2 and 3 was mapped', 'Value': -0.1412667710248118}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521534581615}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329471721}]\n" ] } ], @@ -388,7 +812,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 was mapped', 'Value': -0.1429039852}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521535}, {'Name': 'feature 3 was mapped', 'Value': 0.0016372141}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329}]\n" + "[{'Name': 'feature 2 was mapped', 'Value': -0.1429039851636571}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521534581615}, {'Name': 'feature 3 was mapped', 'Value': 0.0016372141388453}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329471721}]\n" ] } ], @@ -413,7 +837,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 3 was mapped', 'Value': 0.0016372141}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521535}, {'Name': 'feature 2 was mapped', 'Value': -0.1429039852}]\n" + "[{'Name': 'feature 3 was mapped', 'Value': 0.0016372141388453}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329471721}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521534581615}, {'Name': 'feature 2 was mapped', 'Value': -0.1429039851636571}]\n" ] } ], @@ -438,7 +862,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature 2 was mapped', 'Value': -0.1429039852}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521535}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329}, {'Name': 'feature 3 was mapped', 'Value': 0.0016372141}]\n" + "[{'Name': 'feature 2 was mapped', 'Value': -0.1429039851636571}, {'Name': 'feature 1 was mapped', 'Value': -0.0829521534581615}, {'Name': 'feature 4 was mapped', 'Value': -0.0013906329471721}, {'Name': 'feature 3 was mapped', 'Value': 0.0016372141388453}]\n" ] } ], @@ -470,7 +894,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'feature 2 was mapped': -0.14290398516365713, 'feature 1 was mapped': -0.08295215345816148, 'feature 3 was mapped': 0.0016372141388452848, 'feature 4 was mapped': -0.001390632947172069}\n" + "{'feature 2 was mapped': -0.1429039851636571, 'feature 1 was mapped': -0.0829521534581615, 'feature 3 was mapped': 0.0016372141388453, 'feature 4 was mapped': -0.0013906329471721}\n" ] } ], @@ -495,7 +919,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[('feature 2 was mapped', -0.14290398516365713), ('feature 1 was mapped', -0.08295215345816148), ('feature 3 was mapped', 0.0016372141388452848), ('feature 4 was mapped', -0.001390632947172069)]\n" + "[('feature 2 was mapped', -0.1429039851636571), ('feature 1 was mapped', -0.0829521534581615), ('feature 3 was mapped', 0.0016372141388453), ('feature 4 was mapped', -0.0013906329471721)]\n" ] } ], @@ -566,7 +990,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': -0.1683519504}, {'Name': 'feature1', 'Value': 0.1082311959}, {'Name': 'feature3', 'Value': 0.0031848344}, {'Name': 'feature4', 'Value': 1.3492e-06}]\n" + "[{'Name': 'feature2', 'Value': -0.1683519503854396}, {'Name': 'feature1', 'Value': 0.1082311959355581}, {'Name': 'feature3', 'Value': 0.0031848343570264}, {'Name': 'feature4', 'Value': 1.3491938096e-06}]\n" ] } ], @@ -601,7 +1025,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': 0.3112559355}, {'Name': 'feature1', 'Value': -0.0252790425}, {'Name': 'feature3', 'Value': -0.0048220485}, {'Name': 'feature4', 'Value': 0.0013892838}]\n" + "[{'Name': 'feature2', 'Value': 0.3112559355490969}, {'Name': 'feature1', 'Value': -0.0252790424773966}, {'Name': 'feature3', 'Value': -0.0048220484958717}, {'Name': 'feature4', 'Value': 0.0013892837533625}]\n" ] } ], @@ -629,7 +1053,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'feature2', 'Value': -0.1429039852}, {'Name': 'feature1', 'Value': -0.0829521535}, {'Name': 'feature3', 'Value': 0.0016372141}, {'Name': 'feature4', 'Value': -0.0013906329}]\n" + "[{'Name': 'feature2', 'Value': -0.1429039851636571}, {'Name': 'feature1', 'Value': -0.0829521534581615}, {'Name': 'feature3', 'Value': 0.0016372141388453}, {'Name': 'feature4', 'Value': -0.0013906329471721}]\n" ] } ], @@ -646,9 +1070,9 @@ ], "metadata": { "kernelspec": { - "display_name": "model_interpreter", + "display_name": "Python 3", "language": "python", - "name": "model_interpreter" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -660,7 +1084,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.12" }, "toc": { "base_numbering": 1, diff --git a/examples/XGB/example.ipynb b/examples/XGB/example.ipynb index 87cad05..3246945 100644 --- a/examples/XGB/example.ipynb +++ b/examples/XGB/example.ipynb @@ -23,7 +23,16 @@ "start_time": "2024-04-08T15:42:38.382943Z" } }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/vscode/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + } + ], "source": [ "import xgboost as xgb\n", "\n", @@ -224,7 +233,18 @@ "start_time": "2024-04-08T15:42:40.892321Z" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "single_model_contribution.fit(xgb_model)" ] @@ -286,7 +306,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'MedInc', 'Value': -0.7173248529}, {'Name': 'Latitude', 'Value': -0.2954589427}, {'Name': 'AveOccup', 'Value': -0.2584415674}, {'Name': 'Longitude', 'Value': -0.194666937}, {'Name': 'AveRooms', 'Value': 0.0455645546}, {'Name': 'HouseAge', 'Value': -0.0052499785}, {'Name': 'AveBedrms', 'Value': -0.0039967196}, {'Name': 'Population', 'Value': -0.0015882736}]\n" + "[{'Name': 'MedInc', 'Value': -0.7147319912910461}, {'Name': 'AveOccup', 'Value': -0.2794199883937836}, {'Name': 'Latitude', 'Value': -0.2189369648694992}, {'Name': 'Longitude', 'Value': -0.1587740033864975}, {'Name': 'AveRooms', 'Value': 0.0441824235022068}, {'Name': 'Population', 'Value': -0.0064344312995672}, {'Name': 'HouseAge', 'Value': -0.0029389760456979}, {'Name': 'AveBedrms', 'Value': -0.0014929284807295}]\n" ] } ], @@ -311,7 +331,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'MedInc': (1.6812, -0.71732485)}, {'Latitude': (36.06, -0.29545894)}, {'AveOccup': (3.8774373259052926, -0.25844157)}, {'Longitude': (-119.01, -0.19466694)}, {'AveRooms': (4.192200557103064, 0.045564555)}, {'HouseAge': (25.0, -0.0052499785)}, {'AveBedrms': (1.0222841225626742, -0.0039967196)}, {'Population': (1392.0, -0.0015882736)}]\n" + "[{'MedInc': (np.float64(1.6812), -0.7147319912910461)}, {'AveOccup': (np.float64(3.8774373259052926), -0.2794199883937836)}, {'Latitude': (np.float64(36.06), -0.2189369648694992)}, {'Longitude': (np.float64(-119.01), -0.1587740033864975)}, {'AveRooms': (np.float64(4.192200557103064), 0.0441824235022068)}, {'Population': (np.float64(1392.0), -0.0064344312995672)}, {'HouseAge': (np.float64(25.0), -0.0029389760456979)}, {'AveBedrms': (np.float64(1.0222841225626742), -0.0014929284807295)}]\n" ] } ], @@ -343,7 +363,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'MedInc feature', 'Value': -0.7173248529}, {'Name': 'Latitude of location', 'Value': -0.2954589427}, {'Name': 'Average occupation', 'Value': -0.2584415674}, {'Name': 'Longitude of location', 'Value': -0.194666937}, {'Name': 'Average number of rooms', 'Value': 0.0455645546}, {'Name': 'Age of house', 'Value': -0.0052499785}, {'Name': 'Average number of bedrooms', 'Value': -0.0039967196}, {'Name': 'Population feature', 'Value': -0.0015882736}]\n" + "[{'Name': 'MedInc feature', 'Value': -0.7147319912910461}, {'Name': 'Average occupation', 'Value': -0.2794199883937836}, {'Name': 'Latitude of location', 'Value': -0.2189369648694992}, {'Name': 'Longitude of location', 'Value': -0.1587740033864975}, {'Name': 'Average number of rooms', 'Value': 0.0441824235022068}, {'Name': 'Population feature', 'Value': -0.0064344312995672}, {'Name': 'Age of house', 'Value': -0.0029389760456979}, {'Name': 'Average number of bedrooms', 'Value': -0.0014929284807295}]\n" ] } ], @@ -386,7 +406,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'MedInc feature', 'Value': -0.7173248529}, {'Name': 'Location', 'Value': -0.4901258796}, {'Name': 'Average occupation', 'Value': -0.2584415674}, {'Name': 'Number of rooms', 'Value': 0.0455645546}, {'Name': 'Age of house', 'Value': -0.0052499785}, {'Name': 'Number of bedrooms', 'Value': -0.0039967196}, {'Name': 'Population feature', 'Value': -0.0015882736}]\n" + "[{'Name': 'MedInc feature', 'Value': -0.7147319912910461}, {'Name': 'Location', 'Value': -0.3777109682559967}, {'Name': 'Average occupation', 'Value': -0.2794199883937836}, {'Name': 'Number of rooms', 'Value': 0.0441824235022068}, {'Name': 'Population feature', 'Value': -0.0064344312995672}, {'Name': 'Age of house', 'Value': -0.0029389760456979}, {'Name': 'Number of bedrooms', 'Value': -0.0014929284807295}]\n" ] } ], @@ -436,7 +456,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'MedInc feature', 'Value': -0.7173248529}, {'Name': 'Latitude of location', 'Value': -0.2954589427}, {'Name': 'Average occupation', 'Value': -0.2584415674}, {'Name': 'Longitude of location', 'Value': -0.194666937}, {'Name': 'Average number of rooms', 'Value': 0.0455645546}]\n" + "[{'Name': 'MedInc feature', 'Value': -0.7147319912910461}, {'Name': 'Average occupation', 'Value': -0.2794199883937836}, {'Name': 'Latitude of location', 'Value': -0.2189369648694992}, {'Name': 'Longitude of location', 'Value': -0.1587740033864975}, {'Name': 'Average number of rooms', 'Value': 0.0441824235022068}]\n" ] } ], @@ -461,7 +481,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'Average number of rooms', 'Value': 0.0455645546}, {'Name': 'Population feature', 'Value': -0.0015882736}, {'Name': 'Average number of bedrooms', 'Value': -0.0039967196}, {'Name': 'Age of house', 'Value': -0.0052499785}, {'Name': 'Longitude of location', 'Value': -0.194666937}, {'Name': 'Average occupation', 'Value': -0.2584415674}, {'Name': 'Latitude of location', 'Value': -0.2954589427}, {'Name': 'MedInc feature', 'Value': -0.7173248529}]\n" + "[{'Name': 'Average number of rooms', 'Value': 0.0441824235022068}, {'Name': 'Average number of bedrooms', 'Value': -0.0014929284807295}, {'Name': 'Age of house', 'Value': -0.0029389760456979}, {'Name': 'Population feature', 'Value': -0.0064344312995672}, {'Name': 'Longitude of location', 'Value': -0.1587740033864975}, {'Name': 'Latitude of location', 'Value': -0.2189369648694992}, {'Name': 'Average occupation', 'Value': -0.2794199883937836}, {'Name': 'MedInc feature', 'Value': -0.7147319912910461}]\n" ] } ], @@ -486,7 +506,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'Name': 'MedInc feature', 'Value': -0.7173248529}, {'Name': 'Latitude of location', 'Value': -0.2954589427}, {'Name': 'Average occupation', 'Value': -0.2584415674}, {'Name': 'Longitude of location', 'Value': -0.194666937}, {'Name': 'Age of house', 'Value': -0.0052499785}, {'Name': 'Average number of bedrooms', 'Value': -0.0039967196}, {'Name': 'Population feature', 'Value': -0.0015882736}, {'Name': 'Average number of rooms', 'Value': 0.0455645546}]\n" + "[{'Name': 'MedInc feature', 'Value': -0.7147319912910461}, {'Name': 'Average occupation', 'Value': -0.2794199883937836}, {'Name': 'Latitude of location', 'Value': -0.2189369648694992}, {'Name': 'Longitude of location', 'Value': -0.1587740033864975}, {'Name': 'Population feature', 'Value': -0.0064344312995672}, {'Name': 'Age of house', 'Value': -0.0029389760456979}, {'Name': 'Average number of bedrooms', 'Value': -0.0014929284807295}, {'Name': 'Average number of rooms', 'Value': 0.0441824235022068}]\n" ] } ], @@ -518,7 +538,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{'MedInc feature': -0.71732485, 'Latitude of location': -0.29545894, 'Average occupation': -0.25844157, 'Longitude of location': -0.19466694, 'Average number of rooms': 0.045564555}\n" + "{'MedInc feature': -0.7147319912910461, 'Average occupation': -0.2794199883937836, 'Latitude of location': -0.2189369648694992, 'Longitude of location': -0.1587740033864975, 'Average number of rooms': 0.0441824235022068}\n" ] } ], @@ -543,7 +563,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[('MedInc feature', -0.71732485), ('Latitude of location', -0.29545894), ('Average occupation', -0.25844157), ('Longitude of location', -0.19466694), ('Average number of rooms', 0.045564555)]\n" + "[('MedInc feature', -0.7147319912910461), ('Average occupation', -0.2794199883937836), ('Latitude of location', -0.2189369648694992), ('Longitude of location', -0.1587740033864975), ('Average number of rooms', 0.0441824235022068)]\n" ] } ], @@ -557,9 +577,9 @@ ], "metadata": { "kernelspec": { - "display_name": "model_interpreter", + "display_name": "Python 3", "language": "python", - "name": "model_interpreter" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -571,7 +591,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.12" }, "toc": { "base_numbering": 1, diff --git a/examples/XGB/example_ohe.ipynb b/examples/XGB/example_ohe.ipynb index 1ca62f2..0b1b361 100644 --- a/examples/XGB/example_ohe.ipynb +++ b/examples/XGB/example_ohe.ipynb @@ -2,14 +2,23 @@ "cells": [ { "cell_type": "code", - "execution_count": 8, + "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:12.028011Z", "start_time": "2024-04-08T15:41:12.021856Z" } }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/vscode/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + } + ], "source": [ "import xgboost as xgb\n", "import pandas as pd\n", @@ -431,7 +440,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:43.632574Z", @@ -445,7 +454,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:46.863390Z", @@ -497,8 +506,8 @@ " 2.555556\n", " 37.88\n", " -122.23\n", - " 1\n", - " 0\n", + " True\n", + " False\n", " \n", " \n", " 1\n", @@ -510,8 +519,8 @@ " 2.109842\n", " 37.86\n", " -122.22\n", - " 0\n", - " 1\n", + " False\n", + " True\n", " \n", " \n", " 2\n", @@ -523,8 +532,8 @@ " 2.802260\n", " 37.85\n", " -122.24\n", - " 1\n", - " 0\n", + " True\n", + " False\n", " \n", " \n", " 3\n", @@ -536,8 +545,8 @@ " 2.547945\n", " 37.85\n", " -122.25\n", - " 1\n", - " 0\n", + " True\n", + " False\n", " \n", " \n", " 4\n", @@ -549,8 +558,8 @@ " 2.181467\n", " 37.85\n", " -122.25\n", - " 1\n", - " 0\n", + " True\n", + " False\n", " \n", " \n", " ...\n", @@ -575,8 +584,8 @@ " 2.560606\n", " 39.48\n", " -121.09\n", - " 0\n", - " 1\n", + " False\n", + " True\n", " \n", " \n", " 20636\n", @@ -588,8 +597,8 @@ " 3.122807\n", " 39.49\n", " -121.21\n", - " 0\n", - " 1\n", + " False\n", + " True\n", " \n", " \n", " 20637\n", @@ -601,8 +610,8 @@ " 2.325635\n", " 39.43\n", " -121.22\n", - " 0\n", - " 1\n", + " False\n", + " True\n", " \n", " \n", " 20638\n", @@ -614,8 +623,8 @@ " 2.123209\n", " 39.43\n", " -121.32\n", - " 0\n", - " 1\n", + " False\n", + " True\n", " \n", " \n", " 20639\n", @@ -627,8 +636,8 @@ " 2.616981\n", " 39.37\n", " -121.24\n", - " 0\n", - " 1\n", + " False\n", + " True\n", " \n", " \n", "\n", @@ -650,22 +659,22 @@ "20639 2.3886 16.0 5.254717 1.162264 1387.0 2.616981 39.37 \n", "\n", " Longitude Over25_Over25 Over25_Under25 \n", - "0 -122.23 1 0 \n", - "1 -122.22 0 1 \n", - "2 -122.24 1 0 \n", - "3 -122.25 1 0 \n", - "4 -122.25 1 0 \n", + "0 -122.23 True False \n", + "1 -122.22 False True \n", + "2 -122.24 True False \n", + "3 -122.25 True False \n", + "4 -122.25 True False \n", "... ... ... ... \n", - "20635 -121.09 0 1 \n", - "20636 -121.21 0 1 \n", - "20637 -121.22 0 1 \n", - "20638 -121.32 0 1 \n", - "20639 -121.24 0 1 \n", + "20635 -121.09 False True \n", + "20636 -121.21 False True \n", + "20637 -121.22 False True \n", + "20638 -121.32 False True \n", + "20639 -121.24 False True \n", "\n", "[20640 rows x 10 columns]" ] }, - "execution_count": 13, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -676,7 +685,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 9, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:49.217697Z", @@ -697,7 +706,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:50.221547Z", @@ -724,7 +733,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:51.099450Z", @@ -747,7 +756,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:51.511241Z", @@ -761,21 +770,32 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 13, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:51.897907Z", "start_time": "2024-04-08T15:41:51.865926Z" } }, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "single_model_contribution.fit(xgb_model)" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 14, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:52.268970Z", @@ -791,7 +811,7 @@ "20046 1.6812 4.192201 1.022284 1392.0 3.877437 36.06 -119.01 \n", "\n", " Over25_Over25 Over25_Under25 \n", - "20046 0 1 \n" + "20046 False True \n" ] } ], @@ -802,7 +822,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2024-04-08T15:41:57.724306Z", @@ -814,7 +834,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "[{'MedInc': (1.6812, -0.6546311)}, {'Latitude': (36.06, -0.31241444)}, {'AveOccup': (3.8774373259052926, -0.2624968)}, {'Longitude': (-119.01, -0.17611653)}, {'AveRooms': (4.192200557103064, 0.03493051)}, {'Over25': ('Under25', -0.01715860329568386)}, {'Population': (1392.0, -0.00079436717)}, {'AveBedrms': (1.0222841225626742, -7.1596354e-05)}]\n" + "[{'MedInc': (1.6812, -0.7084755301475525)}, {'AveOccup': (3.8774373259052926, -0.2854442596435547)}, {'Longitude': (-119.01, -0.2148669511079788)}, {'Latitude': (36.06, -0.1998697817325592)}, {'Over25': ('Under25', -0.0240731034427881)}, {'Population': (1392.0, -0.0047826147638261)}, {'AveRooms': (4.192200557103064, 0.0046221083030105)}, {'AveBedrms': (1.0222841225626742, -0.0011028625303879)}]\n" ] } ], @@ -828,9 +848,9 @@ ], "metadata": { "kernelspec": { - "display_name": "model_interpreter", + "display_name": "Python 3", "language": "python", - "name": "model_interpreter" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -842,7 +862,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.12" }, "toc": { "base_numbering": 1, diff --git a/examples/non_standard_model.ipynb b/examples/non_standard_model.ipynb index 0036b2e..74381de 100644 --- a/examples/non_standard_model.ipynb +++ b/examples/non_standard_model.ipynb @@ -469,9 +469,9 @@ ], "metadata": { "kernelspec": { - "display_name": "model_interpreter", + "display_name": "Python 3", "language": "python", - "name": "model_interpreter" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -483,7 +483,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.12" }, "toc": { "base_numbering": 1, From 3488005fb9d1348179dcbb8c317bcc05f41e42f1 Mon Sep 17 00:00:00 2001 From: Ritunjai-Sharma <48599782+Ritunjai-Sharma@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:39:33 +0000 Subject: [PATCH 4/4] Updated Changelog --- CHANGELOG.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3f9d728..324ed16 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,7 +16,14 @@ Subsections for each version can be one of the following; Each individual change should have a link to the pull request after the description of the change. -1.0.1 (unreleased) +2.0.0 (unreleased) +------------------ + +Changed +^^^^^^^ +- chore: bump minimum python to 310, upgrade black for security fix (need for py310 forced a major version upgrade) + +1.1.1 (2024-03-26) ------------------ Changed @@ -27,7 +34,7 @@ Changed - Fixed spelling mistakes and removed stale tubular references (https://github.com/azukds/model_interpreter/pull/8) - Added example doctests to interpreter.py (https://github.com/azukds/model_interpreter/pull/10) -1.0.0 (2024-08-06) +1.1.0 (2024-11-28) ------------------- Added