Skip to content

Commit a19f49a

Browse files
committed
Updates for scikit-learn 1.4
Signed-off-by: Beat Buesser <[email protected]>
1 parent bfff6b5 commit a19f49a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/ci-scikit-learn.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
include:
31-
- name: scikit-learn 1.2.2 (Python 3.10)
32-
framework: scikitlearn
33-
scikit-learn: 1.2.2
34-
python: '3.10'
3531
- name: scikit-learn 1.3.2 (Python 3.10)
3632
framework: scikitlearn
3733
scikit-learn: 1.3.2

tests/attacks/evasion/test_lowprofool.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def train_nn(self, nn_model, x, y, learning_rate, epochs):
128128
optimizer.step()
129129

130130

131+
@pytest.mark.only_with_platform("scikitlearn")
131132
def test_general_iris_lr(iris_dataset):
132133
"""
133134
Check whether the produced adversaries are correct,
@@ -140,7 +141,7 @@ def test_general_iris_lr(iris_dataset):
140141
lr_clf.fit(x_train, y_train)
141142
clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)
142143

143-
lpf_slr = LowProFool(classifier=clf_slr, n_steps=25, eta=0.02, lambd=1.5)
144+
lpf_slr = LowProFool(classifier=clf_slr, n_steps=2500, eta=0.02, lambd=1.5)
144145
lpf_slr.fit_importances(x_train, y_train)
145146

146147
sample = x_valid
@@ -170,6 +171,7 @@ def test_general_iris_lr(iris_dataset):
170171
_ = lpf_slr.generate(x=np.ones((sample.shape[0], 11)), y=target)
171172

172173

174+
@pytest.mark.only_with_platform("scikitlearn")
173175
def test_general_wines_lr(wine_dataset):
174176
"""
175177
Check whether the produced adversaries are correct,
@@ -204,6 +206,7 @@ def test_general_wines_lr(wine_dataset):
204206
assert success_rate > expected
205207

206208

209+
@pytest.mark.only_with_platform("scikitlearn")
207210
def test_general_cancer_lr(breast_cancer_dataset):
208211
"""
209212
Check whether the produced adversaries are correct,
@@ -281,6 +284,7 @@ def test_general_iris_nn(iris_dataset):
281284
assert success_rate > expected
282285

283286

287+
@pytest.mark.only_with_platform("scikitlearn")
284288
def test_general_cancer_svc(breast_cancer_dataset):
285289
"""
286290
Check whether the produced adversaries are correct,
@@ -316,6 +320,7 @@ def test_general_cancer_svc(breast_cancer_dataset):
316320
assert success_rate > expected
317321

318322

323+
@pytest.mark.only_with_platform("scikitlearn")
319324
def test_fit_importances(iris_dataset):
320325
"""
321326
Check whether feature importance is calculated properly.
@@ -329,7 +334,7 @@ def pearson_correlations(x, y):
329334
return result
330335

331336
# Setup classifier
332-
lr_clf = LogisticRegression(penalty="l2")
337+
lr_clf = LogisticRegression(penalty=None)
333338
lr_clf.fit(x_train, y_train)
334339
clf_slr = ScikitlearnLogisticRegression(model=lr_clf, clip_values=clip_values)
335340

@@ -385,14 +390,15 @@ def pearson_correlations(x, y):
385390
assert is_vec_fit_valid
386391

387392

393+
@pytest.mark.only_with_platform("scikitlearn")
388394
def test_clipping(iris_dataset):
389395
"""
390396
Check weather adversaries are clipped properly.
391397
"""
392398
(x_train, y_train, x_valid, y_valid), _, clip_values = iris_dataset
393399

394400
# Setup classifier
395-
lr_clf = LogisticRegression(penalty="l2")
401+
lr_clf = LogisticRegression(penalty=None)
396402
lr_clf.fit(x_train, y_train)
397403

398404
# Dataset min-max clipping values

0 commit comments

Comments
 (0)