Skip to content

Commit 1debffa

Browse files
author
Thierry RAMORASOAVINA
committed
Adapt to scikit-learn 1.8.0
- Since version 1.7.2 the new parameters or functions are already available so no deprecated calls should remain - For python 3.10, 1.7.2 is still used - For python 3.11+, the later 1.8.0+ versions are used - The khiopspydev dev image for rocky is updated to get rid of obsolete python versions
1 parent b81ec6e commit 1debffa

File tree

8 files changed

+14
-24
lines changed

8 files changed

+14
-24
lines changed

.github/workflows/pip.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
# because the `env` context is only accessible at the step level;
7272
# hence, it is hard-coded
7373
image: |-
74-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || 'latest' }}
74+
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '11.0.0.3' }}
7575
steps:
7676
- name: Set parameters as env
7777
run: |

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# because the `env` context is only accessible at the step level;
4343
# hence, it is hard-coded
4444
image: |-
45-
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || 'latest' }}
45+
ghcr.io/khiopsml/khiops-python/khiopspydev-ubuntu22.04:${{ inputs.image-tag || '11.0.0.3' }}
4646
credentials:
4747
username: ${{ github.actor }}
4848
password: ${{ secrets.GITHUB_TOKEN }}
@@ -361,7 +361,7 @@ jobs:
361361
# because the `env` context is only accessible at the step level;
362362
# hence, it is hard-coded
363363
image: |-
364-
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || 'latest' }}
364+
ghcr.io/khiopsml/khiops-python/khiopspydev-${{ matrix.container }}:${{ inputs.image-tag || '11.0.0.3' }}
365365
credentials:
366366
username: ${{ github.actor }}
367367
password: ${{ secrets.GITHUB_TOKEN }}

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ nbconvert==6.4.4
55
nbformat==5.3.0
66
numpydoc>=1.5.0
77
pandas>=0.25.3,<=2.3.3
8-
scikit-learn>=0.22.2,<=1.7.2
8+
scikit-learn>=1.7.2,<1.9.0
99
sphinx-copybutton>=0.5.0

khiops/sklearn/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ def __init__(self, name, array, key=None):
10771077
raise TypeError(type_error_message("array", array, np.ndarray, Sequence))
10781078

10791079
# Initialize the members
1080-
self.data_source = check_array(array, ensure_2d=True, force_all_finite=False)
1080+
self.data_source = check_array(array, ensure_2d=True, ensure_all_finite=False)
10811081
self.column_ids = column_or_1d(range(self.data_source.shape[1]))
10821082
self.khiops_types = {
10831083
column_id: get_khiops_type(self.data_source.dtype)

packaging/conda/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ requirements:
2525
- python
2626
- khiops-core =11.0.0
2727
- pandas >=0.25.3,<=2.3.3
28-
- scikit-learn >=0.22.2
28+
- scikit-learn>=1.7.2,<1.9.0
2929
run_constrained:
3030
# do not necessary use the latest version
3131
# to avoid undesired breaking changes

packaging/docker/khiopspydev/Dockerfile.rocky

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ RUN true \
2121
git \
2222
pandoc \
2323
wget \
24-
# Install Python 3.11 if on Rocky 8 \
25-
&& if [ "$KHIOPSDEV_OS" = "rocky8" ]; then \
24+
# Install Python 3.11 on Rocky 8 or 9 as they come with obsolete versions (<= 3.9) \
25+
&& if [ "$KHIOPSDEV_OS" = "rocky8" -o "$KHIOPSDEV_OS" = "rocky9" ]; then \
2626
dnf install -y \
2727
python3.11 \
2828
python3.11-pip \
2929
python3.11-setuptools ; \
30-
else \
31-
dnf install -y \
32-
python3-setuptools \
33-
python3-pip ; \
3430
fi \
3531
# Get Linux distribution codename \
3632
&& if [ -f /etc/os-release ]; then . /etc/os-release; fi \
@@ -47,14 +43,10 @@ RUN true \
4743
&& module unload mpi \
4844
# Hard-code OpenMPI module name \
4945
&& module load mpi/openmpi-x86_64 \
50-
# Set python to python3.11 and pip to Pip 3.11 on Rocky 8 \
51-
# Set python to python3 on Rocky 9 \
52-
&& if [ "$KHIOPSDEV_OS" = "rocky8" ]; then \
46+
# Set python to python3.11 and pip to Pip 3.11 on Rocky 8 and 9 \
47+
&& if [ "$KHIOPSDEV_OS" = "rocky8" -o "$KHIOPSDEV_OS" = "rocky9" ]; then \
5348
alternatives --set python /usr/bin/python3.11 \
54-
&& alternatives --install /usr/bin/pip pip /usr/bin/pip3.11 1 ; \
55-
else \
56-
alternatives --install /usr/bin/python python /usr/bin/python3 1 \
57-
&& alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 ; \
49+
&& alternatives --set pip /usr/bin/pip3.11; \
5850
fi \
5951
# Install miniforge to have multiple Python versions via Conda \
6052
&& mkdir -p /root/miniforge3 && cd /root/miniforge3 \

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ requires-python = ">=3.8"
106106
dependencies = [
107107
# do not use the latest versions, to avoid undesired breaking changes
108108
"pandas>=0.25.3,<=2.3.3",
109-
"scikit-learn>=0.22.2,<=1.7.2",
109+
"scikit-learn>=1.7.2,<1.9.0",
110110
]
111111

112112
[project.urls]

tests/test_sklearn.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import numpy as np
1919
import pandas as pd
2020
from sklearn.exceptions import NotFittedError
21-
from sklearn.utils.estimator_checks import check_estimator
21+
from sklearn.utils.estimator_checks import estimator_checks_generator
2222
from sklearn.utils.validation import check_is_fitted
2323

2424
import khiops.core as kh
@@ -1784,9 +1784,7 @@ def test_sklearn_check_estimator(self):
17841784
# Execute sklearn's estimator test battery
17851785
print("")
17861786
for khiops_estimator in khiops_estimators:
1787-
for estimator, check in check_estimator(
1788-
khiops_estimator, generate_only=True
1789-
):
1787+
for estimator, check in estimator_checks_generator(khiops_estimator):
17901788
check_name = check.func.__name__
17911789
if check_name == "check_n_features_in_after_fitting":
17921790
continue

0 commit comments

Comments
 (0)