Skip to content

Commit e6cef4c

Browse files
authored
MAINT create a new build for intermediate scikit-learn (#961)
1 parent 43dde5d commit e6cef4c

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

azure-pipelines.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ jobs:
162162
TEST_DOCS: 'true'
163163
TEST_DOCSTRINGS: 'true'
164164
CHECK_WARNINGS: 'true'
165+
# Test the intermediate version of scikit-learn
166+
pylatest_pip_openblas_sklearn_intermediate:
167+
DISTRIB: 'conda-pip-latest'
168+
PYTHON_VERSION: '3.10'
169+
TEST_DOCS: 'true'
170+
TEST_DOCSTRINGS: 'true'
171+
CHECK_WARNINGS: 'false'
172+
SKLEARN_VERSION: '1.1.3'
165173
pylatest_pip_tensorflow:
166174
DISTRIB: 'conda-pip-latest-tensorflow'
167175
CONDA_CHANNEL: 'conda-forge'

imblearn/ensemble/tests/test_bagging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ def roughly_balanced_bagging(X, y, replace=False):
582582

583583
for estimator in rbb.estimators_:
584584
class_counts = estimator[-1].class_counts_
585-
assert (class_counts[0] / class_counts[1]) > 0.8
585+
assert (class_counts[0] / class_counts[1]) > 0.78
586586

587587

588588
def test_balanced_bagging_classifier_n_features():

imblearn/keras/tests/test_generator.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import pytest
33
from scipy import sparse
4+
from sklearn.cluster import KMeans
45
from sklearn.datasets import load_iris
56

67
keras = pytest.importorskip("keras")
@@ -37,7 +38,9 @@ def _build_keras_model(n_classes, n_features):
3738

3839
def test_balanced_batch_generator_class_no_return_indices(data):
3940
with pytest.raises(ValueError, match="needs to have an attribute"):
40-
BalancedBatchGenerator(*data, sampler=ClusterCentroids(), batch_size=10)
41+
BalancedBatchGenerator(
42+
*data, sampler=ClusterCentroids(estimator=KMeans(n_init=1)), batch_size=10
43+
)
4144

4245

4346
@pytest.mark.filterwarnings("ignore:`wait_time` is not used") # keras 2.2.4
@@ -85,7 +88,10 @@ def test_balanced_batch_generator_class_sparse(data, keep_sparse):
8588
def test_balanced_batch_generator_function_no_return_indices(data):
8689
with pytest.raises(ValueError, match="needs to have an attribute"):
8790
balanced_batch_generator(
88-
*data, sampler=ClusterCentroids(), batch_size=10, random_state=42
91+
*data,
92+
sampler=ClusterCentroids(estimator=KMeans(n_init=10)),
93+
batch_size=10,
94+
random_state=42,
8995
)
9096

9197

imblearn/tests/test_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@ def test_fit_predict_on_pipeline():
387387
# transform and clustering steps separately
388388
iris = load_iris()
389389
scaler = StandardScaler()
390-
km = KMeans(random_state=0)
390+
km = KMeans(random_state=0, n_init=10)
391391
# As pipeline doesn't clone estimators on construction,
392392
# it must have its own estimators
393393
scaler_for_pipeline = StandardScaler()
394-
km_for_pipeline = KMeans(random_state=0)
394+
km_for_pipeline = KMeans(random_state=0, n_init=10)
395395

396396
# first compute the transform and clustering step separately
397397
scaled = scaler.fit_transform(iris.data)

0 commit comments

Comments
 (0)