From 980ebb1c2cba0281a4d1307818da9ce3a26341ce Mon Sep 17 00:00:00 2001 From: Secbone Date: Sun, 10 Dec 2023 16:01:23 +0800 Subject: [PATCH 1/9] add: support for py3.12 --- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows.yml | 2 +- CHANGELOG.md | 4 +++- pyproject.toml | 1 + setup.py | 1 + 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7225c16..70ae8f9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -6,7 +6,7 @@ jobs: test: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] experimental: [false] fail-fast: false runs-on: ubuntu-latest diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 029a610..9ad590c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -6,7 +6,7 @@ jobs: test: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] experimental: [false] fail-fast: false runs-on: macos-latest diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 58e26ed..eec40a3 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -6,7 +6,7 @@ jobs: test: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] experimental: [false] fail-fast: false runs-on: windows-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b3f7d..aa1fe8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Changed +### Add +- Added wheel package supported for `py3.12` +### Changed - Update `pandas` version to `>=1.5` - Python `3.7` is no longer supported diff --git a/pyproject.toml b/pyproject.toml index 3827863..b324ad3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ classifiers = [ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ] dynamic = [ "version", diff --git a/setup.py b/setup.py index 30ae10a..89a04ce 100644 --- a/setup.py +++ b/setup.py @@ -70,6 +70,7 @@ def get_requirements(stage = None): 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], entry_points = { 'console_scripts': [ From 7b8acd3266f22aaeaf0f0df646cc92cee3f7c888 Mon Sep 17 00:00:00 2001 From: Secbone Date: Sun, 10 Dec 2023 16:42:03 +0800 Subject: [PATCH 2/9] fixed: requirements-nn platform --- requirements-nn.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/requirements-nn.txt b/requirements-nn.txt index 8c93348..0c6d2cf 100644 --- a/requirements-nn.txt +++ b/requirements-nn.txt @@ -1,5 +1,2 @@ -torch >= 1.8.1; sys_platform != 'darwin' -torchvision >= 0.9.1; sys_platform != 'darwin' - -torch >= 1.8.1; sys_platform == 'darwin' -torchvision >= 0.9.1; sys_platform == 'darwin' +torch >= 1.8.1 +torchvision >= 0.9.1 From 2afe161d3af80cf0265994332f20269652f397e1 Mon Sep 17 00:00:00 2001 From: Secbone Date: Tue, 12 Dec 2023 12:15:12 +0800 Subject: [PATCH 3/9] docs: fixed quality params docs --- README.md | 2 +- toad/stats.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2b2fc9c..bbe1d99 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ The following showcases some of the most popular features of toad, for more deta - Simple IV calculation for all features · 一键算IV: ```python -toad.quality(data,'target',iv_only=True) +toad.quality(data, 'target', indicators = ['iv']) ``` - Preliminary selection based on criteria · 根据特定条件的初步变量筛选; diff --git a/toad/stats.py b/toad/stats.py index 1b1a9f4..02a5477 100644 --- a/toad/stats.py +++ b/toad/stats.py @@ -340,6 +340,7 @@ def quality(dataframe, target = 'target', cpu_cores = 0, iv_only = False, indica dataframe (DataFrame): dataframe that will be calculate quality target (str): the target's name in dataframe iv_only (bool): `deprecated`. if only calculate IV + indicators (list): indictors will be calc, it can be customized indictor functions, default is ['iv', 'gini', 'entropy', 'unique'] cpu_cores (int): the maximun number of CPU cores will be used, `0` means all CPUs will be used, `-1` means all CPUs but one will be used. From 8f32e96f2ae9aa9c7818cb06ca5ec606a5041867 Mon Sep 17 00:00:00 2001 From: Secbone Date: Sun, 17 Dec 2023 23:31:36 +0800 Subject: [PATCH 4/9] docs: update shield img --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bbe1d99..cb0806d 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ We welcome public feedback and new PRs. We hold a WeChat group for questions and [pypi-image]: https://img.shields.io/pypi/v/toad.svg?style=flat-square [pypi-url]: https://pypi.org/project/toad/ [python-image]: https://img.shields.io/pypi/pyversions/toad.svg?style=flat-square -[actions-image]: https://img.shields.io/github/workflow/status/amphibian-dev/toad/Release?style=flat-square +[actions-image]: https://img.shields.io/github/actions/workflow/status/amphibian-dev/toad/release.yml?style=flat-square [actions-url]: https://github.com/amphibian-dev/toad/actions [downloads-image]: https://img.shields.io/pypi/dm/toad?style=flat-square [docs-url]: https://toad.readthedocs.io/ From f0eb70432a8845e43f96d88c501a873dceccd5ef Mon Sep 17 00:00:00 2001 From: Secbone Date: Sun, 24 Mar 2024 13:21:02 +0800 Subject: [PATCH 5/9] fixed: backward selection when only one feature left --- README.md | 4 ++-- toad/selection.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb0806d..3fb10b8 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,9 @@ We welcome public feedback and new PRs. We hold a WeChat group for questions and ## Dedicated by **The ESC Team** -[pypi-image]: https://img.shields.io/pypi/v/toad.svg?style=flat-square +[pypi-image]: https://img.shields.io/pypi/v/toad?style=flat-square [pypi-url]: https://pypi.org/project/toad/ -[python-image]: https://img.shields.io/pypi/pyversions/toad.svg?style=flat-square +[python-image]: https://img.shields.io/pypi/pyversions/toad?style=flat-square [actions-image]: https://img.shields.io/github/actions/workflow/status/amphibian-dev/toad/release.yml?style=flat-square [actions-url]: https://github.com/amphibian-dev/toad/actions [downloads-image]: https://img.shields.io/pypi/dm/toad?style=flat-square diff --git a/toad/selection.py b/toad/selection.py index a59a57a..bade0be 100644 --- a/toad/selection.py +++ b/toad/selection.py @@ -161,6 +161,10 @@ def stepwise(frame, target = 'target', estimator = 'ols', direction = 'both', cr test_res = np.empty(l, dtype = object) if direction == 'backward': + # break when only one single feature left + if l < 2: + break + for i in range(l): test_res[i] = sm.stats( df[ remaining[:i] + remaining[i+1:] ], From 4952f4851281cf57ece40861e570b818b02a444a Mon Sep 17 00:00:00 2001 From: Secbone Date: Sun, 24 Mar 2024 14:30:35 +0800 Subject: [PATCH 6/9] chore: fix test approx in metrics --- toad/metrics_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toad/metrics_test.py b/toad/metrics_test.py index 73e672e..465605f 100644 --- a/toad/metrics_test.py +++ b/toad/metrics_test.py @@ -56,11 +56,11 @@ def test_KS_bucket_with_cum_lift(): def test_F1(): result, split = F1(feature, target, return_split = True) - assert result == 0.6844207723035951 + assert result == pytest.approx(0.6844207723035951, FUZZ_THRESHOLD) def test_F1_split(): result = F1(feature, target, split = 0.5) - assert result == 0.51417004048583 + assert result == pytest.approx(0.51417004048583, FUZZ_THRESHOLD) def test_AUC(): result = AUC(feature, target) From 2b2f31f1a597314e43677ffe26b64da9c3d26ba8 Mon Sep 17 00:00:00 2001 From: Secbone Date: Wed, 10 Jul 2024 09:42:01 +0800 Subject: [PATCH 7/9] docs: fix readthedocs config --- .readthedocs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.readthedocs.yml b/.readthedocs.yml index 8a6159e..57592a2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,5 +1,10 @@ version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.11" + sphinx: configuration: docs/source/conf.py From cb1dc45a22b49770bdb0431f84ce5592db29a7c0 Mon Sep 17 00:00:00 2001 From: Secbone Date: Wed, 10 Jul 2024 09:48:10 +0800 Subject: [PATCH 8/9] docs: fix readthedocs config --- .readthedocs.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 57592a2..102966f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,16 +6,14 @@ build: python: "3.11" sphinx: - configuration: docs/source/conf.py + configuration: docs/source/conf.py formats: all python: - version: 3.8 - install: - - requirements: requirements.txt - - requirements: requirements-nn.txt - - requirements: docs/requirements.txt - - - method: setuptools - path: . + install: + - requirements: requirements.txt + - requirements: requirements-nn.txt + - requirements: docs/requirements.txt + - method: setuptools + path: . From 02361cf75a07615ba5267b1bdf6fe1ce0f013aec Mon Sep 17 00:00:00 2001 From: Julien Nyambal Date: Wed, 10 Jul 2024 11:50:39 +0200 Subject: [PATCH 9/9] restricts numpy's version to complied one. Conflict encountered with numpy v2.x --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9431b5f..78c9c74 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ Cython >= 0.29.15 -numpy >= 1.20 +numpy <= 2.0.0 pandas >= 1.5 scipy joblib >= 0.12