8000
File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -332,6 +332,12 @@ Changelog
332
332
given the split condition.
333
333
:pr:`28552` by :user:`Adam Li <adam2392>`.
334
334
335
+ :mod:`sklearn.utils`
336
+ ....................
337
+
338
+ - |API| :func:`utils.tosequence` is deprecated and will be removed in version 1.7.
339
+ :pr:`28763` by :user:`Jérémie du Boisberranger <jeremiedbb>`.
340
+
335
341
.. rubric:: Code and documentation contributors
336
342
337
343
Thanks to everyone who has contributed to the maintenance and improvement of
Original file line number Diff line number Diff line change 22
22
from sklearn .pipeline import make_pipeline
23
23
from sklearn .preprocessing import scale
24
24
from sklearn .svm import NuSVR
25
- from sklearn .utils import check_random_state , tosequence
25
+ from sklearn .utils import check_random_state
26
26
from sklearn .utils ._mocking import NoSampleWeightWrapper
27
27
from sklearn .utils ._param_validation import InvalidParameterError
28
28
from sklearn .utils ._testing import (
<
8000
svg aria-hidden="true" focusable="false" class="octicon octicon-fold-down" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom"> @@ -529,10 +529,10 @@ def test_symbol_labels():
529
529
# Test with non-integer class labels.
530
530
clf = GradientBoostingClassifier (n_estimators = 100 , random_state = 1 )
531
531
532
- symbol_y = tosequence (map (str , y ))
532
+ symbol_y = list (map (str , y ))
533
533
534
534
clf .fit (X , symbol_y )
535
- assert_array_equal (clf .predict (T ), tosequence (map (str , true_result )))
535
+ assert_array_equal (clf .predict (T ), list (map (str , true_result )))
536
536
assert 100 == len (clf .estimators_ )
537
537
538
538
Original file line number Diff line number Diff line change 86
86
_IS_WASM = platform .machine () in ["wasm32" , "wasm64" ]
87
87
88
88
89
+ # TODO(1.7): remove tosequence
90
+ @deprecated ("tosequence was deprecated in 1.5 and will be removed in 1.7" )
89
91
def tosequence (x ):
90
92
"""Cast iterable x to a Sequence, avoiding a copy if possible.
91
93
Original file line number Diff line number Diff line change 8
8
column_or_1d ,
9
9
deprecated ,
10
10
safe_mask ,
11
+ tosequence ,
11
12
)
12
13
from sklearn .utils ._missing import is_scalar_nan
13
14
from sklearn .utils ._testing import assert_array_equal , assert_no_warnings
@@ -157,3 +158,9 @@ def __init__(self):
157
158
self .schema = ["a" , "b" ]
158
159
159
160
assert not _is_polars_df (LooksLikePolars ())
161
+
162
+
163
+ # TODO(1.7): remove
164
+ def test_tosequence_deprecated ():
165
+ with pytest .warns (FutureWarning , match = "tosequence was deprecated in 1.5" ):
166
+ tosequence ([1 , 2 , 3 ])
You can’t perform that action at this time.
0 commit comments