Skip to content

Bump scikit-learn from 1.4.1.post1 to 1.6.0 #2532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/deepspeech-v3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Get base image
FROM python:3.10.13-slim-bullseye
FROM python:3.10.13-slim-bookworm

# Set to install things in non-interactive mode
ENV DEBIAN_FRONTEND noninteractive
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/espresso/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Get base image
FROM python:3.7.17-slim-bullseye
FROM python:3.7.17-slim-bookworm

# Set to install things in non-interactive mode
ENV DEBIAN_FRONTEND noninteractive
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/goturn/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Get base image
FROM python:3.8.19-slim-bullseye
FROM python:3.8.19-slim-bookworm

ENV MONO_TLS_PROVIDER=legacy

# Install system wide software
RUN apt-get update \
Expand Down
5 changes: 2 additions & 3 deletions .github/actions/tfv2-faster-rcnn/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Get base from a tensorflow image
FROM tensorflow/tensorflow:2.10.1
FROM tensorflow/tensorflow:2.13.0

# Set to install things in non-interactive mode
ENV DEBIAN_FRONTEND noninteractive
Expand Down Expand Up @@ -38,10 +38,9 @@ RUN cd TensorFlow && wget https://github.com/protocolbuffers/protobuf/releases/d
RUN cd TensorFlow && unzip protoc-3.17.3-linux-x86_64.zip -d protobuf
RUN cd TensorFlow/models/research && /TensorFlow/protobuf/bin/protoc object_detection/protos/*.proto --python_out=.
RUN cd TensorFlow/models/research && cp object_detection/packages/tf2/setup.py .
RUN cd TensorFlow/models/research && python -m pip install --use-feature=2020-resolver .
RUN cd TensorFlow/models/research && python -m pip install .

RUN pip install tqdm
RUN pip install requests
RUN pip install sklearn
RUN pip install numba==0.50.0
RUN pip install pytest-cov
2 changes: 1 addition & 1 deletion .github/workflows/ci-deepspeech-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
test_deepspeech_v3_torch_2_1_1:
name: PyTorchDeepSpeech v3 / PyTorch 2.1.1
runs-on: ubuntu-latest
container: adversarialrobustnesstoolbox/art_testing_envs:deepspeech_v3_torch_2_1_1
container: bbuesser/art_testing_env_deepspeech_v3_torch_2_1_1:latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-espresso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
test_espresso:
name: PyTorchEspresso
runs-on: ubuntu-latest
container: adversarialrobustnesstoolbox/art_testing_envs:espresso
container: bbuesser/art_testing_env_espresso:latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-goturn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
test_pytorch_goturn:
name: PyTorchGoturn
runs-on: ubuntu-latest
container: adversarialrobustnesstoolbox/art_testing_envs:goturn
container: bbuesser/art_testing_env_goturn:latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
matrix:
module: [attacks_1, attacks_2, estimators, defences, metrics, art]
include:
- name: legacy (TensorFlow 2.14.0 Keras 2.14.0 PyTorch 1.13.1 scikit-learn 1.1.3 Python 3.9)
- name: legacy (TensorFlow 2.14.0 Keras 2.14.0 PyTorch 1.13.1 scikit-learn 1.6.1 Python 3.9)
framework: legacy
python: '3.10'
tensorflow: 2.14.0
keras: 2.14.0
torch: 1.13.1+cpu
torchvision: 0.14.1+cpu
torchaudio: 0.13.1+cpu
scikit-learn: 1.1.3
scikit-learn: 1.6.1

name: Run ${{ matrix.module }} ${{ matrix.name }} Tests
steps:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-scikit-learn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
fail-fast: false
matrix:
include:
- name: scikit-learn 1.3.2 (Python 3.10)
- name: scikit-learn 1.5.2 (Python 3.10)
framework: scikitlearn
scikit-learn: 1.3.2
scikit-learn: 1.5.2
python: '3.10'
- name: scikit-learn 1.4.0 (Python 3.10)
- name: scikit-learn 1.6.1 (Python 3.10)
framework: scikitlearn
scikit-learn: 1.4.0
scikit-learn: 1.6.1
python: '3.10'

name: ${{ matrix.name }}
Expand All @@ -50,7 +50,7 @@ jobs:
sudo apt-get update
sudo apt-get -y -q install ffmpeg libavcodec-extra
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements_test.txt
pip install -q -r <(sed '/^scikit-learn/d' requirements_test.txt)
pip install scikit-learn==${{ matrix.scikit-learn }}
pip list
- name: Run Tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tfv2-faster-rcnn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
test_tf_v2_faster_rcnn:
name: TensorFlowV2FasterRCNN
runs-on: ubuntu-latest
container: adversarialrobustnesstoolbox/art_testing_envs:tfv2-faster-rcnn
container: bbuesser/art_testing_env_tfv2-faster-rcnn:latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
numpy>=1.18.5,<1.27
scipy==1.10.1
matplotlib==3.7.1
scikit-learn==1.4.1.post1
scikit-learn==1.6.1
six==1.17.0
Pillow==11.1.0
tqdm==4.67.1
Expand Down
10 changes: 5 additions & 5 deletions tests/attacks/inference/attribute_inference/test_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def transform_feature(x):
baseline_inferred_test
)

expected_train_acc = {"nn": 0.58, "rf": 0.98, "gb": 0.98, "lr": 0.77, "dt": 0.98, "knn": 0.86, "svm": 0.83}
expected_test_acc = {"nn": 0.62, "rf": 0.86, "gb": 0.82, "lr": 0.86, "dt": 0.84, "knn": 0.82, "svm": 0.93}
expected_train_acc = {"nn": 0.58, "rf": 0.98, "gb": 0.98, "lr": 0.77, "dt": 0.98, "knn": 0.84, "svm": 0.83}
expected_test_acc = {"nn": 0.62, "rf": 0.83, "gb": 0.79, "lr": 0.86, "dt": 0.82, "knn": 0.82, "svm": 0.93}

assert expected_train_acc[model_type] <= baseline_train_acc
assert expected_test_acc[model_type] <= baseline_test_acc
Expand Down Expand Up @@ -176,7 +176,7 @@ def transform_feature(x):
)

expected_train_acc = {"nn": 0.58, "rf": 0.98, "gb": 0.98, "lr": 0.77, "dt": 0.98, "knn": 0.85, "svm": 0.83}
expected_test_acc = {"nn": 0.62, "rf": 0.86, "gb": 0.82, "lr": 0.86, "dt": 0.8, "knn": 0.81, "svm": 0.93}
expected_test_acc = {"nn": 0.62, "rf": 0.83, "gb": 0.82, "lr": 0.86, "dt": 0.8, "knn": 0.81, "svm": 0.93}

assert expected_train_acc[model_type] <= baseline_train_acc
assert expected_test_acc[model_type] <= baseline_test_acc
Expand Down Expand Up @@ -228,7 +228,7 @@ def transform_feature(x):
)

expected_train_acc = {"nn": 0.58, "rf": 0.98, "gb": 0.98, "lr": 0.77, "dt": 0.98, "knn": 0.85, "svm": 0.83}
expected_test_acc = {"nn": 0.62, "rf": 0.88, "gb": 0.82, "lr": 0.86, "dt": 0.8, "knn": 0.81, "svm": 0.93}
expected_test_acc = {"nn": 0.62, "rf": 0.82, "gb": 0.8, "lr": 0.86, "dt": 0.8, "knn": 0.81, "svm": 0.93}

assert expected_train_acc[model_type] <= baseline_train_acc
assert expected_test_acc[model_type] <= baseline_test_acc
Expand Down Expand Up @@ -510,7 +510,7 @@ def transform_other_feature(x):
)

expected_train_acc = {"nn": 0.58, "rf": 0.94, "gb": 0.95, "lr": 0.8, "dt": 0.94, "knn": 0.87, "svm": 0.8}
expected_test_acc = {"nn": 0.62, "rf": 0.84, "gb": 0.84, "lr": 0.86, "dt": 0.82, "knn": 0.86, "svm": 0.88}
expected_test_acc = {"nn": 0.62, "rf": 0.82, "gb": 0.84, "lr": 0.86, "dt": 0.79, "knn": 0.86, "svm": 0.88}

assert expected_train_acc[model_type] <= baseline_train_acc
assert expected_test_acc[model_type] <= baseline_test_acc
Expand Down
67 changes: 41 additions & 26 deletions tests/estimators/classification/test_scikitlearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_type(self):

def test_predict(self):
y_predicted = self.classifier.predict(self.x_test_iris[0:1])
y_expected = np.asarray([[3.07686594e-16, 2.23540978e-02, 9.77645902e-01]])
y_expected = np.asarray([[0.25544427, 0.35099888, 0.39355685]])
np.testing.assert_array_almost_equal(y_predicted, y_expected, decimal=4)

def test_save(self):
Expand Down Expand Up @@ -298,9 +298,9 @@ def test_class_gradient_none_1(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:1], label=None)
grad_expected = [
[
[-1.98021257, 1.35627806, -6.28222561, -2.60076308],
[-0.56322294, -0.70427608, -0.98874801, -0.67053026],
[0.6508137, 0.26377308, 1.54522324, 0.80972391],
[-1.97804999, 1.35988402, -6.28209543, -2.59983373],
[-0.56164223, -0.70078993, -0.98865014, -0.66950917],
[0.64962, 0.2610305, 1.54549754, 0.80910802],
]
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=3)
Expand All @@ -309,45 +309,60 @@ def test_class_gradient_none_2(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:2], label=None)
grad_expected = [
[
[-1.98021257, 1.35627806, -6.28222561, -2.60076308],
[-0.56322294, -0.70427608, -0.98874801, -0.67053026],
[0.6508137, 0.26377308, 1.54522324, 0.80972391],
[
-1.97804999,
1.35988402,
-6.28209543,
-2.59983397,
],
[
-0.56164235,
-0.70078993,
-0.98865038,
-0.66950929,
],
[
0.64961988,
0.26103044,
1.5454973,
0.8091079,
],
],
[
[-1.92227495, 1.34355378, -6.11815596, -2.52638054],
[-0.50528532, -0.71700042, -0.82467848, -0.59614766],
[0.70875132, 0.25104877, 1.70929277, 0.88410652],
[-1.9202075, 1.34698176, -6.1180439, -2.5255065],
[-0.50379974, -0.71369207, -0.82459873, -0.59518182],
[0.70746249, 0.24812828, 1.70954895, 0.88343531],
],
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=3)

def test_class_gradient_int_1(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:1], label=1)
grad_expected = [[[-0.56317311, -0.70493763, -0.98908609, -0.67106276]]]
grad_expected = [[[-0.56164223, -0.70078993, -0.98865014, -0.66950917]]]

for i_shape in range(4):
self.assertAlmostEqual(grad_predicted[0, 0, i_shape], grad_expected[0][0][i_shape], 3)

def test_class_gradient_int_2(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:2], label=1)
grad_expected = [
[[-0.56317306, -0.70493776, -0.98908573, -0.67106259]],
[[-0.50522697, -0.71762568, -0.82497531, -0.5966416]],
[[-0.56164235, -0.70078993, -0.98865038, -0.66950929]],
[[-0.50379974, -0.71369207, -0.82459873, -0.59518182]],
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

def test_class_gradient_list_1(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:1], label=[1])
grad_expected = [[[-0.56317311, -0.70493763, -0.98874801, -0.67106276]]]
grad_expected = [[[-0.56164223, -0.70078993, -0.98865014, -0.66950917]]]

for i_shape in range(4):
self.assertAlmostEqual(grad_predicted[0, 0, i_shape], grad_expected[0][0][i_shape], 3)

def test_class_gradient_list_2(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:2], label=[1, 2])
grad_expected = [
[[-0.56317306, -0.70493776, -0.98908573, -0.67106259]],
[[0.70866591, 0.25158876, 1.70947325, 0.88450021]],
[[-0.56164235, -0.70078993, -0.98865038, -0.66950929]],
[[0.70746249, 0.24812828, 1.70954895, 0.88343531]],
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=3)

Expand All @@ -362,7 +377,7 @@ def test_class_gradient_label_wrong_type(self):

def test_loss_gradient(self):
grad_predicted = self.classifier.loss_gradient(self.x_test_iris[0:1], self.y_test_iris[0:1])
grad_expected = np.asarray([[-0.21690657, -0.08809226, -0.51512082, -0.27002635]])
grad_expected = np.asarray([[-0.21654, -0.08701016, -0.51516586, -0.26970267]])
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

def test_save(self):
Expand Down Expand Up @@ -541,36 +556,36 @@ def test_class_gradient_none(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:1], label=None)
grad_expected = [
[
[-0.34648966, 1.63777444, -3.51845999, -1.4609451],
[-0.11198028, -2.51565392, 0.71538245, -0.44830889],
[-0.38021886, -0.57562105, 3.59966607, 2.31772514],
[-0.34659522, 1.6376213, -3.51851979, -1.46078468],
[-0.1121541, -2.51552211, 0.71569165, -0.44883585],
[-0.380205, -0.57552204, 3.59972012, 2.31760663],
]
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

def test_class_gradient_int_1(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:1], label=1)
grad_expected = [[[-0.11198028, -2.51565392, 0.71538245, -0.44830889]]]
grad_expected = [[[-0.1121541, -2.51552211, 0.71569165, -0.44883585]]]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

def test_class_gradient_int_2(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:2], label=1)
grad_expected = [
[[-0.11198028, -2.51565392, 0.71538245, -0.44830889]],
[[-0.11198028, -2.51565392, 0.71538245, -0.44830889]],
[[-0.1121541, -2.51552211, 0.71569165, -0.44883585]],
[[-0.1121541, -2.51552211, 0.71569165, -0.44883585]],
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

def test_class_gradient_list_1(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:1], label=[1])
grad_expected = [[[-0.11198028, -2.51565392, 0.71538245, -0.44830889]]]
grad_expected = [[[-0.1121541, -2.51552211, 0.71569165, -0.44883585]]]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

def test_class_gradient_list_2(self):
grad_predicted = self.classifier.class_gradient(self.x_test_iris[0:2], label=[1, 2])
grad_expected = [
[[-0.11198028, -2.51565392, 0.71538245, -0.44830889]],
[[-0.38021886, -0.57562105, 3.59966607, 2.31772514]],
[[-0.1121541, -2.51552211, 0.71569165, -0.44883585]],
[[-0.380205, -0.57552204, 3.59972012, 2.31760663]],
]
np.testing.assert_array_almost_equal(grad_predicted, grad_expected, decimal=4)

Expand Down
8 changes: 4 additions & 4 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1748,10 +1748,10 @@ def get_tabular_classifier_scikit_list(clipped=False, model_list_names=None):
)

sklearn_version = list(map(int, sklearn.__version__.split(".")))
if sklearn_version[0] == 1 and sklearn_version[1] == 3:
suffix = "-eq-1.3.0"
elif sklearn_version[0] == 1 and sklearn_version[1] == 4:
suffix = "-eq-1.4.0"
if sklearn_version[0] == 1 and sklearn_version[1] == 5:
suffix = "-eq-1.5.2"
elif sklearn_version[0] == 1 and sklearn_version[1] == 6:
suffix = "-eq-1.6.1"
else:
suffix = ""

Expand Down
4 changes: 2 additions & 2 deletions utils/resources/create_model_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def create_scikit_model_weights():
os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"resources/models/scikit/",
"scikit-" + model_name + "-iris-clipped-eq-1.4.0.pickle",
"scikit-" + model_name + "-iris-clipped-eq-1.6.1.pickle",
),
"wb",
),
Expand All @@ -168,7 +168,7 @@ def create_scikit_model_weights():
os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"resources/models/scikit/",
"scikit-" + model_name + "-iris-unclipped-eq-1.4.0.pickle",
"scikit-" + model_name + "-iris-unclipped-eq-1.6.1.pickle",
),
"wb",
),
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.