8000 MAINT Remove deprecated kwargs support in density (#27925) · punndcoder28/scikit-learn@1170f21 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1170f21

Browse files
authored
MAINT Remove deprecated kwargs support in density (scikit-learn#27925)
1 parent 410b9ee commit 1170f21

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

sklearn/utils/extmath.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,34 +133,19 @@ def fast_logdet(A):
133133
return ld
134134

135135

136-
def density(w, **kwargs):
136+
def density(w):
137137
"""Compute density of a sparse vector.
138138
139139
Parameters
140140
----------
141141
w : array-like
142142
The sparse vector.
143-
**kwargs : keyword arguments
144-
Ignored.
145-
146-
.. deprecated:: 1.2
147-
``**kwargs`` were deprecated in version 1.2 and will be removed in
148-
1.4.
149143
150144
Returns
151145
-------
152146
float
153147
The density of w, between 0 and 1.
154148
"""
155-
if kwargs:
156-
warnings.warn(
157-
(
158-
"Additional keyword arguments are deprecated in version 1.2 and will be"
159-
" removed in version 1.4."
160-
),
161-
FutureWarning,
162-
)
163-
164149
if hasattr(w, "toarray"):
165150
d = float(w.nnz) / (w.shape[0] * w.shape[1])
166151
else:

sklearn/utils/tests/test_extmath.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,6 @@ def test_density(sparse_container):
6060
assert density(sparse_container(X)) == density(X)
6161

6262

63-
# TODO(1.4): Remove test
64-
def test_density_deprecated_kwargs():
65-
"""Check that future warning is raised when user enters keyword arguments."""
66-
test_array = np.array([[1, 2, 3], [4, 5, 6]])
67-
with pytest.warns(
68-
FutureWarning,
69-
match=(
70-
"Additional keyword arguments are deprecated in version 1.2 and will be"
71-
" removed in version 1.4."
72-
),
73-
):
74-
density(test_array, a=1)
75-
76-
7763
def test_uniform_weights():
7864
# with uniform weights, results should be identical to stats.mode
7965
rng = np.random.RandomState(0)

0 commit comments

Comments
 (0)
0