10BC0 FIX Ignore distutils warning in scipy-dev [scipy-dev] by thomasjpfan · Pull Request #21517 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
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
7 changes: 5 additions & 2 deletions build_tools/azure/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ if [[ "$COVERAGE" == "true" ]]; then
# report that otherwise hides the test failures and forces long scrolls in
# the CI logs.
export COVERAGE_PROCESS_START="$BUILD_SOURCESDIRECTORY/.coveragerc"
TEST_CMD="$TEST_CMD --cov-config=$COVERAGE_PROCESS_START --cov sklearn --cov-report="
TEST_CMD="$TEST_CMD --cov-config='$COVERAGE_PROCESS_START' --cov sklearn --cov-report="
fi

if [[ -n "$CHECK_WARNINGS" ]]; then
# numpy's 1.19.0's tostring() deprecation is ignored until scipy and joblib removes its usage
TEST_CMD="$TEST_CMD -Werror::DeprecationWarning -Werror::FutureWarning -Wignore:tostring:DeprecationWarning"

# Python 3.10 deprecates disutils and is imported by numpy interally during import time
TEST_CMD="$TEST_CMD -Wignore:The\ distutils:DeprecationWarning"
fi

if [[ "$PYTEST_XDIST_VERSION" != "none" ]]; then
TEST_CMD="$TEST_CMD -n2"
fi

set -x
$TEST_CMD --pyargs sklearn
eval "$TEST_CMD --pyargs sklearn"
set +x
8000
6 changes: 6 additions & 0 deletions doc/whats_new/v1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Changelog
and :class:`decomposition.MiniBatchSparsePCA` to be convex and match the referenced
article. :pr:`19210` by :user:`Jérémie du Boisberranger <jeremiedbb>`.

:mod:`sklearn.preprocessing`
............................

- |Fix| Fixes compatibility bug with NumPy 1.22 in :class:`preprocessing.OneHotEncoder`.
:pr:`21517` by `Thomas Fan`_.

:mod:`sklearn.utils`
....................

Expand Down
2 changes: 1 addition & 1 deletion sklearn/cluster/tests/test_dbscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def test_dbscan_metric_params():
min_samples=min_samples,
algorithm="ball_tree",
).fit(X)
assert not warns
assert not warns, warns[0].message
core_sample_1, labels_1 = db.core_sample_indices_, db.labels_

# Test that sample labels are the same as passing Minkowski 'p' directly
Expand Down
2 changes: 1 addition & 1 deletion sklearn/preprocessing/_encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def transform(self, X):

indptr = np.empty(n_samples + 1, dtype=int)
indptr[0] = 0
np.sum(X_mask, axis=1, out=indptr[1:])
np.sum(X_mask, axis=1, out=indptr[1:], dtype=indptr.dtype)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a major fix for numpy 1.22 otherwise the encoder does not work at all. I think this should be backported to 1.0.2.

np.cumsum(indptr[1:], out=indptr[1:])
data = np.ones(indptr[-1])

Expand Down
0