8000 FIX Ignore distutils warning in [scipy-dev] + fix numpy 1.22 support … · scikit-learn/scikit-learn@60cf98b · GitHub
[go: up one dir, main page]

Skip to content
< 8000 header class="HeaderMktg header-logged-out js-details-container js-header Details f4 py-3" role="banner" data-is-top="true" data-color-mode=light data-light-theme=light data-dark-theme=dark>

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60cf98b

Browse files
thomasjpfanogrisel
andauthored
FIX Ignore distutils warning in [scipy-dev] + fix numpy 1.22 support in OneHotEncoder (#21517)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent dd3d034 commit 60cf98b

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

build_tools/azure/test_script.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,21 @@ if [[ "$COVERAGE" == "true" ]]; then
3535
# report that otherwise hides the test failures and forces long scrolls in
3636
# the CI logs.
3737
export COVERAGE_PROCESS_START="$BUILD_SOURCESDIRECTORY/.coveragerc"
38-
TEST_CMD="$TEST_CMD --cov-config=$COVERAGE_PROCESS_START --cov sklearn --cov-report="
38+
TEST_CMD="$TEST_CMD --cov-config='$COVERAGE_PROCESS_START' --cov sklearn --cov-report="
3939
fi
4040

4141
if [[ -n "$CHECK_WARNINGS" ]]; then
4242
# numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage
4343
TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning"
44+
45+
# Python 3.10 deprecates disutils and is imported by numpy interally during import time
46+
TEST_CMD="$TEST_CMD -Wignore:The\ distutils:DeprecationWarning"
4447
fi
4548

4649
if [[ "$PYTEST_XDIST_VERSION" != "none" ]]; then
4750
TEST_CMD="$TEST_CMD -n2"
4851
fi
4952

5053
set -x
51-
$TEST_CMD --pyargs sklearn
54+
eval "$TEST_CMD --pyargs sklearn"
5255
set +x

doc/whats_new/v1.0.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ Changelog
2828
and :class:`decomposition.MiniBatchSparsePCA` to be convex and match the referenced
2929
article. :pr:`19210` by :user:`Jérémie du Boisberranger <jeremiedbb>`.
3030

31+
:mod:`sklearn.preprocessing`
32+
............................
33+
34+
- |Fix| Fixes compatibility bug with NumPy 1.22 in :class:`preprocessing.OneHotEncoder`.
35+
:pr:`21517` by `Thomas Fan`_.
36+
3137
:mod:`sklearn.utils`
3238
....................
3339

sklearn/cluster/tests/test_dbscan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def test_dbscan_metric_params():
180180
min_samples=min_samples,
181181
algorithm="ball_tree",
182182
).fit(X)
183-
assert not warns
183+
assert not warns, warns[0].message
184184
core_sample_1, labels_1 = db.core_sample_indices_, db.labels_
185185

186186
# Test that sample labels are the same as passing Minkowski 'p' directly

sklearn/preprocessing/_encoders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def transform(self, X):
544544

545545
indptr = np.empty(n_samples + 1, dtype=int)
546546
indptr[0] = 0
547-
np.sum(X_mask, axis=1, out=indptr[1:])
547+
np.sum(X_mask, axis=1, out=indptr[1:], dtype=indptr.dtype)
548548
np.cumsum(indptr[1:], out=indptr[1:])
549549
data = np.ones(indptr[-1])
550550

0 commit comments

Comments
 (0)
0