Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MAINT: Adapt sklearn for NumPy default integer change #27041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

seberg
Copy link
Contributor

@seberg seberg commented Aug 9, 2023

This adepts the _random.pyx file to return whatever is the NumPy default integer, which, on NumPy 2.0 would fix.
Since the cython symbol wasn't used, I just removed it as it bites with the overloading.

See numpy/numpy#24224 for the commit which would make this necessary.

At the time this is a bit hard to test since the SciPy nightlies are incompatible with that NumPy branch. But I thought I would put it out there for discussion.

The alternative and simpler solution might be to just force 64bit results on any 64bit system and not worry about the NumPy version.


The interesting part here will be windows testing, but that is a bit held up on scipy nightlies upload. Although, if anyone does windows development and would try this that would be cool!
I.e. this is a draft, but I am hope I can hack in windows testing later.

@github-actions
Copy link

github-actions bot commented Aug 9, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: c4c167e. Link to the linter CI: here

@seberg seberg force-pushed the default-int branch 2 times, most recently from 215ca52 to 2e9b6d4 Compare August 9, 2023 12:37
@adrinjalali
Copy link
Member

cc @Micky774 maybe?

@seberg
Copy link
Contributor Author

seberg commented Nov 2, 2023

Close/reopen to trigger CI. This is now becoming relevant since NumPy main has the change in place allowing to test against the change. Since I guess we are not testing on windows+numpy nightly, there will be a chance that this is not complete!

EDIT: To be clear, I would be very happy if anyone takes over and just uses this for inspiration. I don't have a windows computer very ready to try this on windows!

@seberg seberg closed this Nov 2, 2023
@seberg seberg reopened this Nov 2, 2023
@seberg seberg marked this pull request as ready for review November 2, 2023 20:46
@seberg
Copy link
Contributor Author

seberg commented Nov 2, 2023

Marking as ready for review. This might not be all there is to it, the main reason why I had it as WIP, was that it needs to be tested against a NumPy 2.0 nightly.

Testing with NumPy 2.0 nightly on windows may then well flush out additional issues.

@seberg seberg changed the title WIP: Adapt sklearn for NumPy default integer change MAINT: Adapt sklearn for NumPy default integer change Nov 2, 2023
@larsoner
Copy link
Contributor

larsoner commented Nov 3, 2023

it needs to be tested against a NumPy 2.0 nightly.

For this it seems like a new CI entry for Windows pip-pre that installs from scientific-python-nightly-wheels would be the way to go (plus maybe a build with --no-build-isolation or so?). But maybe some sklearn maintainer has a better idea

@seberg
Copy link
Contributor Author

seberg commented Nov 3, 2023

Right, let's see if I can just hack it into the windows job here. If there is worry after it succeeds (and is again reverted it here), one could probably add a nightly run for windows also, I think. (not sure how the infra works to create the issue)

@seberg seberg force-pushed the default-int branch 3 times, most recently from 12bd61f to d895739 Compare November 3, 2023 16:01
@seberg
Copy link
Contributor Author

seberg commented Nov 3, 2023

I will leave the hacks in place, in case someone wants to have a look. But the failures are unrelated:

  • Lots of deprecation warnings on main (hopefully easy to fix, but unrelated). Mostly due to _core rename and newbyteorder() method. Not sure how hard to fix, but unrelated. Added a commit to fix those hopefully.
  • One/two failures related to float64 vs. float32. Presumably due to NEP 50

So, while it could be that there are other places where you now use long but intp/Py_ssize_t would be nicer with NumPy 2, I think this fixes all immediate problems.

This adepts the `_random.pyx` file to return whatever is the NumPy
default integer, which, on NumPy 2.0 would fix.
Since the cython symbol wasn't used, I just removed it as it bites
with the overloading.

See numpy/numpy#24224 for the commit which
would make this necessary.

At the time this is a bit hard to test since the SciPy nightlies are
incompatible with that NumPy branch.  But I thought I would put it out
there for discussion.

The alternative and simpler solution might be to just force 64bit
results on any 64bit system and not worry about the NumPy version.
@seberg
Copy link
Contributor Author

seberg commented Nov 6, 2023

OK, I just rebased away the CI changes to run against NumPy main branch on windows. So this is OK to merge unless there is code that should be changed. As mentioned, both branches are being taken in CI, because the branches are used on old numpy versions for linux vs. windows (the difference is windows switching which branch is taken on new NumPy).

Windows test results against NumPy main in details block: https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=60607&view=logs&jobId=0238e32a-2fbb-5be1-f782-cfff4ef2924e&j=0238e32a-2fbb-5be1-f782-cfff4ef2924e&t=7a1155ea-f171-542f-2ca6-f7f6ff076f10

2023-11-03T18:04:40.3409269Z ================================== FAILURES ===================================
2023-11-03T18:04:40.3412305Z �[31m�[1m__________________ test_dict_learning_lassocd_readonly_data ___________________�[0m
2023-11-03T18:04:40.3414266Z [gw0] win32 -- Python 3.10.13 C:\Miniconda\envs\testvenv\python.exe
2023-11-03T18:04:40.3416421Z joblib.externals.loky.process_executor._RemoteTraceback: 
2023-11-03T18:04:40.3417903Z """
2023-11-03T18:04:40.3418812Z Traceback (most recent call last):
2023-11-03T18:04:40.3420730Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\joblib\externals\loky\backend\queues.py", line 159, in _feed
2023-11-03T18:04:40.3423301Z     obj_ = dumps(obj, reducers=reducers)
2023-11-03T18:04:40.3424701Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\joblib\externals\loky\backend\reduction.py", line 215, in dumps
2023-11-03T18:04:40.3426121Z     dump(obj, buf, reducers=reducers, protocol=protocol)
2023-11-03T18:04:40.3427437Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\joblib\externals\loky\backend\reduction.py", line 208, in dump
2023-11-03T18:04:40.3428963Z     _LokyPickler(file, reducers=reducers, protocol=protocol).dump(obj)
2023-11-03T18:04:40.3430612Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\joblib\externals\cloudpickle\cloudpickle_fast.py", line 632, in dump
2023-11-03T18:04:40.3432301Z     return Pickler.dump(self, obj)
2023-11-03T18:04:40.3433868Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\joblib\_memmapping_reducer.py", line 385, in __call__
2023-11-03T18:04:40.3435684Z     return _reduce_memmap_backed(a, m)
2023-11-03T18:04:40.3437111Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\joblib\_memmapping_reducer.py", line 269, in _reduce_memmap_backed
2023-11-03T18:04:40.3438257Z     a_start, a_end = np.byte_bounds(a)
2023-11-03T18:04:40.3439603Z   File "C:\Miniconda\envs\testvenv\lib\site-packages\numpy\__init__.py", line 402, in __getattr__
2023-11-03T18:04:40.3441063Z     raise AttributeError(
2023-11-03T18:04:40.3442847Z AttributeError: `np.byte_bounds` was removed in the NumPy 2.0 release. Now it's available under `np.lib.array_utils.byte_bounds`
2023-11-03T18:04:40.3444104Z """
2023-11-03T18:04:40.3444994Z 
2023-11-03T18:04:40.3446503Z �[33mThe above exception was the direct cause of the following exception:�[0m
2023-11-03T18:04:40.3447273Z 
2023-11-03T18:04:40.3447993Z     def test_dict_learning_lassocd_readonly_data():
2023-11-03T18:04:40.3449253Z         n_components = 12
2023-11-03T18:04:40.3450003Z         with TempMemmap(X) as X_read_only:
2023-11-03T18:04:40.3450807Z             dico = DictionaryLearning(
2023-11-03T18:04:40.3451729Z                 n_components,
2023-11-03T18:04:40.3453590Z                 transform_algorithm="lasso_cd",
2023-11-03T18:04:40.3454509Z                 transform_alpha=0.001,
2023-11-03T18:04:40.3455306Z                 random_state=0,
2023-11-03T18:04:40.3456096Z                 n_jobs=4,
2023-11-03T18:04:40.3457251Z             )
2023-11-03T18:04:40.3458347Z             with ignore_warnings(category=ConvergenceWarning):
2023-11-03T18:04:40.3459266Z >               code = dico.fit(X_read_only).transform(X_read_only)
2023-11-03T18:04:40.3459986Z 
2023-11-03T18:04:40.3461183Z X_read_only = memmap([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3462954Z          -0.97727788,  0.95008842, -0.151357...    [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.3464456Z          -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.3465395Z dico       = DictionaryLearning(n_components=12, n_jobs=4, random_state=0,
2023-11-03T18:04:40.3466502Z                    transform_algorithm='lasso_cd', transform_alpha=0.001)
2023-11-03T18:04:40.3467364Z n_components = 12
2023-11-03T18:04:40.3467866Z 
2023-11-03T18:04:40.3469406Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\decomposition\tests\test_dict_learning.py�[0m:243: 
2023-11-03T18:04:40.3470692Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-11-03T18:04:40.3472370Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\decomposition\_dict_learning.py�[0m:1801: in fit
2023-11-03T18:04:40.3473783Z     self.fit_transform(X)
2023-11-03T18:04:40.3474681Z         X          = memmap([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3477800Z          -0.97727788,  0.95008842, -0.151357...    [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.3479840Z          -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.3480892Z         self       = DictionaryLearning(n_components=12, n_jobs=4, random_state=0,
2023-11-03T18:04:40.3482866Z                    transform_algorithm='lasso_cd', transform_alpha=0.001)
2023-11-03T18:04:40.3484236Z         y          = None
2023-11-03T18:04:40.3485560Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\utils\_set_output.py�[0m:146: in wrapped
2023-11-03T18:04:40.3486701Z     data_to_wrap = f(self, X, *args, **kwargs)
2023-11-03T18:04:40.3487660Z         X          = memmap([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3489040Z          -0.97727788,  0.95008842, -0.151357...    [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.3490248Z          -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.3491064Z         args       = ()
2023-11-03T18:04:40.3491984Z         f          = <function DictionaryLearning.fit_transform at 0x00000246CBEDD7E0>
2023-11-03T18:04:40.3492874Z         kwargs     = {}
2023-11-03T18:04:40.3493719Z         method     = 'transform'
2023-11-03T18:04:40.3494696Z         self       = DictionaryLearning(n_components=12, n_jobs=4, random_state=0,
2023-11-03T18:04:40.3495922Z                    transform_algorithm='lasso_cd', transform_alpha=0.001)
2023-11-03T18:04:40.3498639Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\base.py�[0m:1215: in wrapper
2023-11-03T18:04:40.3500027Z     return fit_method(estimator, *args, **kwargs)
2023-11-03T18:04:40.3501426Z         args       = (memmap([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3502995Z          -0.97727788,  0.95008842, -0.15135...  [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.3504246Z          -0.57884966, -0.31155253,  0.05616534]]),)
2023-11-03T18:04:40.3505440Z         estimator  = DictionaryLearning(n_components=12, n_jobs=4, random_state=0,
2023-11-03T18:04:40.3506574Z                    transform_algorithm='lasso_cd', transform_alpha=0.001)
2023-11-03T18:04:40.3507621Z         fit_method = <function DictionaryLearning.fit_transform at 0x00000246CBEDD750>
2023-11-03T18:04:40.3508589Z         global_skip_validation = False
2023-11-03T18:04:40.3509335Z         kwargs     = {}
2023-11-03T18:04:40.3510021Z         partial_fit_and_fitted = False
2023-11-03T18:04:40.3510790Z         prefer_skip_nested_validation = True
2023-11-03T18:04:40.3512295Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\decomposition\_dict_learning.py�[0m:1834: in fit_transform
2023-11-03T18:04:40.3513735Z     V, U, E, self.n_iter_ = _dict_learning(
2023-11-03T18:04:40.3514709Z         X          = array([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3516145Z         -0.97727788,  0.95008842, -0.15135721...     [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.3517687Z         -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.3518681Z         method     = 'lasso_lars'
2023-11-03T18:04:40.3519439Z         n_components = 12
2023-11-03T18:04:40.3520202Z         random_state = RandomState(MT19937) at 0x246DC369D40
2023-11-03T18:04:40.3521311Z         self       = DictionaryLearning(n_components=12, n_jobs=4, random_state=0,
2023-11-03T18:04:40.3522383Z                    transform_algorithm='lasso_cd', transform_alpha=0.001)
2023-11-03T18:04:40.3523263Z         y          = None
2023-11-03T18:04:40.3524511Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\decomposition\_dict_learning.py�[0m:604: in _dict_learning
2023-11-03T18:04:40.3525675Z     code = sparse_encode(
2023-11-03T18:04:40.3526494Z         S          = array([4.90599395, 4.7350762 , 3.80704179, 3.08684778, 2.02942787,
2023-11-03T18:04:40.3527395Z        1.86508467, 1.27479624, 1.15030047])
2023-11-03T18:04:40.3528288Z         X          = array([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3529657Z         -0.97727788,  0.95008842, -0.15135721...     [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.3531017Z         -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.3531942Z         alpha      = 1
2023-11-03T18:04:40.3532630Z         callback   = None
2023-11-03T18:04:40.3533683Z         code       = array([[ 0.58302691, -0.32994156, -0.34155086,  0.44246197,  0.27131171,
2023-11-03T18:04:40.3534774Z         -0.00990698,  0.20920967,  0.22478   ....30173587,
2023-11-03T18:04:40.3535687Z          0.66156271,  0.07685871,  0.18231863,  0.        ,  0.        ,
2023-11-03T18:04:40.3536527Z          0.        ,  0.        ]])
2023-11-03T18:04:40.3537233Z         code_init  = None
2023-11-03T18:04:40.3537904Z         current_cost = nan
2023-11-03T18:04:40.3538575Z         dict_init  = None
2023-11-03T18:04:40.3539440Z         dictionary = array([[ 3.22426622,  0.11017826,  2.0162069 ,  0.47726965,  2.67275177,
2023-11-03T18:04:40.3541124Z          0.89204513,  1.1950562 , -0.01903307...     [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
2023-11-03T18:04:40.3542365Z          0.        ,  0.        ,  0.        ]])
2023-11-03T18:04:40.3543113Z         dt         = 0.0
2023-11-03T18:04:40.3543773Z         errors     = []
2023-11-03T18:04:40.3544593Z         ii         = 0
2023-11-03T18:04:40.3545233Z         max_iter   = 1000
2023-11-03T18:04:40.3545997Z         method     = 'lasso_lars'
2023-11-03T18:04:40.3546727Z         method_max_iter = 1000
2023-11-03T18:04:40.3547406Z         n_components = 12
2023-11-03T18:04:40.3548078Z         n_jobs     = 4
2023-11-03T18:04:40.3548751Z         positive_code = False
2023-11-03T18:04:40.3549452Z         positive_dict = False
2023-11-03T18:04:40.3550123Z         r          = 8
2023-11-03T18:04:40.3550831Z         random_state = RandomState(MT19937) at 0x246DC369D40
2023-11-03T18:04:40.3551610Z         return_n_iter = True
2023-11-03T18:04:40.3552292Z         t0         = 1699034075.8030663
2023-11-03T18:04:40.3552999Z         tol        = 1e-08
2023-11-03T18:04:40.3553663Z         verbose    = False
2023-11-03T18:04:40.3554957Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\utils\_param_validation.py�[0m:187: in wrapper
2023-11-03T18:04:40.3556088Z     return func(*args, **kwargs)
2023-11-03T18:04:40.3556919Z         args       = (array([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.3558343Z         -0.97727788,  0.95008842, -0.1513572...    [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
2023-11-03T18:04:40.3559316Z          0.        ,  0.        ,  0.        ]]))
2023-11-03T18:04:40.3560125Z         func       = <function sparse_encode at 0x00000246CBEDC9D0>
2023-11-03T18:04:40.3561189Z         global_skip_validation = True
2023-11-03T18:04:40.3563152Z         kwargs     = {'algorithm': 'lasso_lars', 'alpha': 1, 'init': array([[ 0.58302691, -0.32994156, -0.34155086,  0.44246197,  0.2713117...156271,  0.07685871,  0.18231863,  0.        ,  0.        ,
2023-11-03T18:04:40.3564826Z          0.        ,  0.        ]]), 'max_iter': 1000, ...}
2023-11-03T18:04:40.6767370Z         parameter_constraints = {'X': ['array-like'], 'algorithm': [<sklearn.utils._param_validation.StrOptions object at 0x00000246CBECB040>], 'alpha': [<sklearn.utils._param_validation.Interval object at 0x00000246CBECB0D0>, None], 'check_input': ['boolean'], ...}
2023-11-03T18:04:40.6769920Z         prefer_skip_nested_validation = True
2023-11-03T18:04:40.6771484Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\decomposition\_dict_learning.py�[0m:361: in sparse_encode
2023-11-03T18:04:40.6773695Z     return _sparse_encode(
2023-11-03T18:04:40.6778511Z         X          = array([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.6780344Z         -0.97727788,  0.95008842, -0.15135721...     [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.6782433Z         -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.6783982Z         algorithm  = 'lasso_lars'
2023-11-03T18:04:40.6784779Z         alpha      = 1
2023-11-03T18:04:40.6785673Z         check_input = True
2023-11-03T18:04:40.6786398Z         copy_cov   = True
2023-11-03T18:04:40.6787107Z         cov        = None
2023-11-03T18:04:40.6788323Z         dictionary = array([[ 3.22426622,  0.11017826,  2.0162069 ,  0.47726965,  2.67275177,
2023-11-03T18:04:40.6789652Z          0.89204513,  1.1950562 , -0.01903307...     [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
2023-11-03T18:04:40.6790637Z          0.        ,  0.        ,  0.        ]])
2023-11-03T18:04:40.6791364Z         gram       = None
2023-11-03T18:04:40.6792339Z         init       = array([[ 0.58302691, -0.32994156, -0.34155086,  0.44246197,  0.27131171,
2023-11-03T18:04:40.6793918Z         -0.00990698,  0.20920967,  0.22478   ....30173587,
2023-11-03T18:04:40.6794971Z          0.66156271,  0.07685871,  0.18231863,  0.        ,  0.        ,
2023-11-03T18:04:40.6795838Z          0.        ,  0.        ]])
2023-11-03T18:04:40.6796577Z         max_iter   = 1000
2023-11-03T18:04:40.6797260Z         n_jobs     = 4
2023-11-03T18:04:40.6798075Z         n_nonzero_coefs = None
2023-11-03T18:04:40.6798756Z         positive   = False
2023-11-03T18:04:40.6799404Z         verbose    = False
2023-11-03T18:04:40.6800611Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\decomposition\_dict_learning.py�[0m:437: in _sparse_encode
2023-11-03T18:04:40.6801818Z     code_views = Parallel(n_jobs=n_jobs, verbose=verbose)(
2023-11-03T18:04:40.6802751Z         X          = array([[ 1.76405235,  0.40015721,  0.97873798,  2.2408932 ,  1.86755799,
2023-11-03T18:04:40.6804051Z         -0.97727788,  0.95008842, -0.15135721...     [ 1.13940068, -1.23482582,  0.40234164, -0.68481009, -0.87079715,
2023-11-03T18:04:40.6805227Z         -0.57884966, -0.31155253,  0.05616534]])
2023-11-03T18:04:40.6806095Z         algorithm  = 'lasso_lars'
2023-11-03T18:04:40.6806802Z         alpha      = 1
2023-11-03T18:04:40.6807805Z         code       = array([[-0.69129194, -0.01843655,  1.08743931, -0.16630789, -0.05426437,
2023-11-03T18:04:40.6808815Z          1.75423258,  0.89596867,  0.24504223....94839195,
2023-11-03T18:04:40.6809900Z          1.07446828, -0.22093535, -0.15414229, -0.48258954,  0.29945754,
2023-11-03T18:04:40.6810762Z          0.12319032,  2.15579371]])
2023-11-03T18:04:40.6811456Z         copy_cov   = False
2023-11-03T18:04:40.6812439Z         cov        = array([[ 1.40327444e+01,  3.36363143e+00, -1.74995263e-01,
2023-11-03T18:04:40.6813687Z          1.27464211e+01,  1.96174555e-01, -9.31133156e+00,
2023-11-03T18:04:40.6814502Z ... 0.00000000e+00,  0.00000000e+00,
2023-11-03T18:04:40.6815277Z          0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
2023-11-03T18:04:40.6816543Z          0.00000000e+00]])
2023-11-03T18:04:40.6817585Z         dictionary = array([[ 3.22426622,  0.11017826,  2.0162069 ,  0.47726965,  2.67275177,
2023-11-03T18:04:40.6820201Z          0.89204513,  1.1950562 , -0.01903307...     [ 0.        ,  0.        ,  0.        ,  0.        ,  0.        ,
2023-11-03T18:04:40.6821573Z          0.        ,  0.        ,  0.        ]])
2023-11-03T18:04:40.6823042Z         gram       = array([[ 2.40687766e+01, -1.27252675e-15,  4.54897145e-15,
2023-11-03T18:04:40.6824129Z          1.21350387e-15,  4.99262770e-16,  5.96596000e-16,
2023-11-03T18:04:40.6825198Z ...         0.00000000e+00,  0.00000000e+00,  0.00000000e+00,
2023-11-03T18:04:40.6826089Z          0.00000000e+00,  0.00000000e+00,  0.00000000e+00]])
2023-11-03T18:04:40.6827346Z         init       = array([[ 0.58302691, -0.32994156, -0.34155086,  0.44246197,  0.27131171,
2023-11-03T18:04:40.6828415Z         -0.00990698,  0.20920967,  0.22478   ....30173587,
2023-11-03T18:04:40.6829271Z          0.66156271,  0.07685871,  0.18231863,  0.        ,  0.        ,
2023-11-03T18:04:40.6830058Z          0.        ,  0.        ]])
2023-11-03T18:04:40.6830724Z         max_iter   = 1000
2023-11-03T18:04:40.6831727Z         n_components = 12
2023-11-03T18:04:40.6832369Z         n_features = 8
2023-11-03T18:04:40.6833002Z         n_jobs     = 4
2023-11-03T18:04:40.6833780Z         n_nonzero_coefs = None
2023-11-03T18:04:40.6834448Z         n_samples  = 10
2023-11-03T18:04:40.6835247Z         positive   = False
2023-11-03T18:04:40.6835874Z         regularization = 1
2023-11-03T18:04:40.6836679Z         slices     = [slice(0, 3, None), slice(3, 6, None), slice(6, 8, None), slice(8, 10, None)]
2023-11-03T18:04:40.6837553Z         verbose    = False
2023-11-03T18:04:40.6838602Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\utils\parallel.py�[0m:67: in __call__
2023-11-03T18:04:40.6839961Z     return super().__call__(iterable_with_config)
2023-11-03T18:04:40.6840909Z         __class__  = <class 'sklearn.utils.parallel.Parallel'>
2023-11-03T18:04:40.6842304Z         config     = {'array_api_dispatch': False, 'assume_finite': False, 'display': 'diagram', 'enable_cython_pairwise_dist': True, ...}
2023-11-03T18:04:40.6843621Z         iterable   = <generator object _sparse_encode.<locals>.<genexpr> at 0x00000246DD732570>
2023-11-03T18:04:40.6844974Z         iterable_with_config = <generator object Parallel.__call__.<locals>.<genexpr> at 0x00000246DD7333E0>
2023-11-03T18:04:40.6845933Z         self       = Parallel(n_jobs=4)
2023-11-03T18:04:40.6846997Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\parallel.py�[0m:1952: in __call__
2023-11-03T18:04:40.6848036Z     return output if self.return_generator else list(output)
2023-11-03T18:04:40.6849143Z         _batched_calls_reducer_callback = <function Parallel.__call__.<locals>._batched_calls_reducer_callback at 0x00000246DD7200D0>
2023-11-03T18:04:40.6850296Z         backend_name = 'LokyBackend'
2023-11-03T18:04:40.6851213Z         iterable   = <generator object Parallel.__call__.<locals>.<genexpr> at 0x00000246DD7333E0>
2023-11-03T18:04:40.6852205Z         iterator   = <itertools.islice object at 0x00000246CEEC8860>
2023-11-03T18:04:40.6853048Z         n_jobs     = 4
2023-11-03T18:04:40.6853810Z         output     = <generator object Parallel._get_outputs at 0x00000246DD7336F0>
2023-11-03T18:04:40.6854637Z         pre_dispatch = 8
2023-11-03T18:04:40.6855270Z         self       = Parallel(n_jobs=4)
2023-11-03T18:04:40.6856386Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\parallel.py�[0m:1595: in _get_outputs
2023-11-03T18:04:40.6857378Z     yield from self._retrieve()
2023-11-03T18:04:40.6858046Z         _remaining_outputs = []
2023-11-03T18:04:40.6858716Z         detach_generator_exit = False
2023-11-03T18:04:40.6859392Z         dispatch_thread_id = 2780
2023-11-03T18:04:40.6860147Z         iterator   = <itertools.islice object at 0x00000246CEEC8860>
2023-11-03T18:04:40.6861015Z         pre_dispatch = 8
2023-11-03T18:04:40.6861647Z         self       = Parallel(n_jobs=4)
2023-11-03T18:04:40.6862703Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\parallel.py�[0m:1699: in _retrieve
2023-11-03T18:04:40.6863675Z     self._raise_error_fast()
2023-11-03T18:04:40.6864333Z         self       = Parallel(n_jobs=4)
2023-11-03T18:04:40.6865462Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\parallel.py�[0m:1734: in _raise_error_fast
2023-11-03T18:04:40.6866652Z     error_job.get_result(self.timeout)
2023-11-03T18:04:40.6867554Z         error_job  = <joblib.parallel.BatchCompletionCallBack object at 0x00000246DD7DE800>
2023-11-03T18:04:40.6868473Z         self       = Parallel(n_jobs=4)
2023-11-03T18:04:40.6869601Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\parallel.py�[0m:736: in get_result
2023-11-03T18:04:40.6870942Z     return self._return_or_raise()
2023-11-03T18:04:40.6871808Z         backend    = <joblib._parallel_backends.LokyBackend object at 0x00000246DD7DDE40>
2023-11-03T18:04:40.6872894Z         self       = <joblib.parallel.BatchCompletionCallBack object at 0x00000246DD7DE800>
2023-11-03T18:04:40.6873766Z         timeout    = None
2023-11-03T18:04:40.6874667Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-11-03T18:04:40.6875467Z 
2023-11-03T18:04:40.6876230Z self = <joblib.parallel.BatchCompletionCallBack object at 0x00000246DD7DE800>
2023-11-03T18:04:40.6876990Z 
2023-11-03T18:04:40.6877574Z     def _return_or_raise(self):
2023-11-03T18:04:40.6878239Z         try:
2023-11-03T18:04:40.6878857Z             if self.status == TASK_ERROR:
2023-11-03T18:04:40.6879560Z >               raise self._result
2023-11-03T18:04:40.6880600Z �[1m�[31mE               _pickle.PicklingError: Could not pickle the task to send it to the workers.�[0m
2023-11-03T18:04:40.6881485Z 
2023-11-03T18:04:40.6882255Z self       = <joblib.parallel.BatchCompletionCallBack object at 0x00000246DD7DE800>
2023-11-03T18:04:40.6883016Z 
2023-11-03T18:04:40.6883980Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\parallel.py�[0m:754: PicklingError
2023-11-03T18:04:40.6885498Z �[31m�[1m___________________ test_dtype_match[BayesianRidge-float32] ___________________�[0m
2023-11-03T18:04:40.6886686Z [gw1] win32 -- Python 3.10.13 C:\Miniconda\envs\testvenv\python.exe
2023-11-03T18:04:40.6887395Z 
2023-11-03T18:04:40.6888375Z dtype = <class 'numpy.float32'>
2023-11-03T18:04:40.6889456Z Estimator = <class 'sklearn.linear_model._bayes.BayesianRidge'>
2023-11-03T18:04:40.6891443Z 
2023-11-03T18:04:40.6892237Z     @pytest.mark.parametrize("dtype", [np.float32, np.float64])
2023-11-03T18:04:40.6893186Z     @pytest.mark.parametrize("Estimator", [BayesianRidge, ARDRegression])
2023-11-03T18:04:40.6894064Z     def test_dtype_match(dtype, Estimator):
2023-11-03T18:04:40.6894935Z         # Test that np.float32 input data is not cast to np.float64 when possible
2023-11-03T18:04:40.6895930Z         X = np.array([[1, 1], [3, 4], [5, 7], [4, 1], [2, 6], [3, 10], [3, 2]], dtype=dtype)
2023-11-03T18:04:40.6896803Z         y = np.array([1, 2, 3, 2, 0, 4, 5]).T
2023-11-03T18:04:40.6897506Z     
2023-11-03T18:04:40.6898102Z         model = Estimator()
2023-11-03T18:04:40.6898817Z         # check type consistency
2023-11-03T18:04:40.6899499Z         model.fit(X, y)
2023-11-03T18:04:40.6900162Z         attributes = ["coef_", "sigma_"]
2023-11-03T18:04:40.6900876Z         for attribute in attributes:
2023-11-03T18:04:40.6901631Z >           assert getattr(model, attribute).dtype == X.dtype
2023-11-03T18:04:40.6902690Z �[1m�[31mE           AssertionError: assert dtype('float64') == dtype('float32')�[0m
2023-11-03T18:04:40.6904157Z �[1m�[31mE            +  where dtype('float64') = array([[ 3.26665424e-04, -2.92833300e-07],\n       [-2.92833300e-07,  3.24167376e-04]]).dtype�[0m
2023-11-03T18:04:40.6906005Z �[1m�[31mE            +    where array([[ 3.26665424e-04, -2.92833300e-07],\n       [-2.92833300e-07,  3.24167376e-04]]) = getattr(BayesianRidge(), 'sigma_')�[0m
2023-11-03T18:04:40.6908036Z �[1m�[31mE            +  and   dtype('float32') = array([[ 1.,  1.],\n       [ 3.,  4.],\n       [ 5.,  7.],\n       [ 4.,  1.],\n       [ 2.,  6.],\n       [ 3., 10.],\n       [ 3.,  2.]], dtype=float32).dtype�[0m
2023-11-03T18:04:40.6909091Z 
2023-11-03T18:04:40.6910090Z Estimator  = <class 'sklearn.linear_model._bayes.BayesianRidge'>
2023-11-03T18:04:40.6910946Z X          = array([[ 1.,  1.],
2023-11-03T18:04:40.6911813Z        [ 3.,  4.],
2023-11-03T18:04:40.6912455Z        [ 5.,  7.],
2023-11-03T18:04:40.6913082Z        [ 4.,  1.],
2023-11-03T18:04:40.6913891Z        [ 2.,  6.],
2023-11-03T18:04:40.6914700Z        [ 3., 10.],
2023-11-03T18:04:40.6915506Z        [ 3.,  2.]], dtype=float32)
2023-11-03T18:04:40.6916841Z attribute  = 'sigma_'
2023-11-03T18:04:40.6918023Z attributes = ['coef_', 'sigma_']
2023-11-03T18:04:40.6919188Z dtype      = <class 'numpy.float32'>
2023-11-03T18:04:40.6920865Z model      = BayesianRidge()
2023-11-03T18:04:40.6921768Z y          = array([1, 2, 3, 2, 0, 4, 5])
2023-11-03T18:04:40.6922475Z 
2023-11-03T18:04:40.6924124Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\linear_model\tests\test_bayes.py�[0m:280: AssertionError
2023-11-03T18:04:40.6925729Z �[31m�[1m___________________ test_dtype_match[ARDRegression-float32] ___________________�[0m
2023-11-03T18:04:40.6927027Z [gw1] win32 -- Python 3.10.13 C:\Miniconda\envs\testvenv\python.exe
2023-11-03T18:04:40.6927931Z 
2023-11-03T18:04:40.6928793Z dtype = <class 'numpy.float32'>
2023-11-03T18:04:40.6929712Z Estimator = <class 'sklearn.linear_model._bayes.ARDRegression'>
2023-11-03T18:04:40.6931377Z 
2023-11-03T18:04:40.6932261Z     @pytest.mark.parametrize("dtype", [np.float32, np.float64])
2023-11-03T18:04:40.6933423Z     @pytest.mark.parametrize("Estimator", [BayesianRidge, ARDRegression])
2023-11-03T18:04:40.6935085Z     def test_dtype_match(dtype, Estimator):
2023-11-03T18:04:40.6935947Z         # Test that np.float32 input data is not cast to np.float64 when possible
2023-11-03T18:04:40.6937096Z         X = np.array([[1, 1], [3, 4], [5, 7], [4, 1], [2, 6], [3, 10], [3, 2]], dtype=dtype)
2023-11-03T18:04:40.6938139Z         y = np.array([1, 2, 3, 2, 0, 4, 5]).T
2023-11-03T18:04:40.6938844Z     
2023-11-03T18:04:40.6939411Z         model = Estimator()
2023-11-03T18:04:40.6940068Z         # check type consistency
2023-11-03T18:04:40.6940741Z         model.fit(X, y)
2023-11-03T18:04:40.6941388Z         attributes = ["coef_", "sigma_"]
2023-11-03T18:04:40.6942097Z         for attribute in attributes:
2023-11-03T18:04:40.6943032Z >           assert getattr(model, attribute).dtype == X.dtype
2023-11-03T18:04:40.6944255Z �[1m�[31mE           AssertionError: assert dtype('float64') == dtype('float32')�[0m
2023-11-03T18:04:40.6945732Z �[1m�[31mE            +  where dtype('float64') = array([[ 8.18069569e-02, -6.98024884e-05],\n       [-6.98024884e-05,  2.86968094e-04]]).dtype�[0m
2023-11-03T18:04:40.6948053Z �[1m�[31mE            +    where array([[ 8.18069569e-02, -6.98024884e-05],\n       [-6.98024884e-05,  2.86968094e-04]]) = getattr(ARDRegression(), 'sigma_')�[0m
2023-11-03T18:04:40.6950252Z �[1m�[31mE            +  and   dtype('float32') = array([[ 1.,  1.],\n       [ 3.,  4.],\n       [ 5.,  7.],\n       [ 4.,  1.],\n       [ 2.,  6.],\n       [ 3., 10.],\n       [ 3.,  2.]], dtype=float32).dtype�[0m
2023-11-03T18:04:40.6951324Z 
2023-11-03T18:04:40.6952193Z Estimator  = <class 'sklearn.linear_model._bayes.ARDRegression'>
2023-11-03T18:04:40.6953270Z X          = array([[ 1.,  1.],
2023-11-03T18:04:40.6954356Z        [ 3.,  4.],
2023-11-03T18:04:40.6955132Z        [ 5.,  7.],
2023-11-03T18:04:40.6955831Z        [ 4.,  1.],
2023-11-03T18:04:40.6956416Z        [ 2.,  6.],
2023-11-03T18:04:40.6957177Z        [ 3., 10.],
2023-11-03T18:04:40.6957779Z        [ 3.,  2.]], dtype=float32)
2023-11-03T18:04:40.6958744Z attribute  = 'sigma_'
2023-11-03T18:04:40.6959515Z attributes = ['coef_', 'sigma_']
2023-11-03T18:04:40.6960512Z dtype      = <class 'numpy.float32'>
2023-11-03T18:04:40.6961266Z model      = ARDRegression()
2023-11-03T18:04:40.6962292Z y          = array([1, 2, 3, 2, 0, 4, 5])
2023-11-03T18:04:40.6962850Z 
2023-11-03T18:04:40.6964142Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\linear_model\tests\test_bayes.py�[0m:280: AssertionError
2023-11-03T18:04:40.6965540Z �[31m�[1m___________________ test_different_endianness_joblib_pickle ___________________�[0m
2023-11-03T18:04:40.6966664Z [gw1] win32 -- Python 3.10.13 C:\Miniconda\envs\testvenv\python.exe
2023-11-03T18:04:40.6967530Z 
2023-11-03T18:04:40.6968334Z     def test_different_endianness_joblib_pickle():
2023-11-03T18:04:40.6969783Z         X, y = datasets.make_classification(random_state=0)
2023-11-03T18:04:40.6970650Z     
2023-11-03T18:04:40.6971524Z         clf = DecisionTreeClassifier(random_state=0, max_depth=3)
2023-11-03T18:04:40.6972850Z         clf.fit(X, y)
2023-11-03T18:04:40.6973660Z         score = clf.score(X, y)
2023-11-03T18:04:40.6974333Z     
2023-11-03T18:04:40.6974979Z         class NonNativeEndiannessNumpyPickler(NumpyPickler):
2023-11-03T18:04:40.6975947Z             def save(self, obj):
2023-11-03T18:04:40.6976820Z                 if isinstance(obj, np.ndarray):
2023-11-03T18:04:40.6977610Z                     obj = obj.byteswap().view(obj.dtype.newbyteorder())
2023-11-03T18:04:40.6978613Z                 super().save(obj)
2023-11-03T18:04:40.6979289Z     
2023-11-03T18:04:40.6979904Z         def get_joblib_pickle_non_native_endianness():
2023-11-03T18:04:40.6980650Z             f = io.BytesIO()
2023-11-03T18:04:40.6981340Z             p = NonNativeEndiannessNumpyPickler(f)
2023-11-03T18:04:40.6982077Z     
2023-11-03T18:04:40.6982608Z             p.dump(clf)
2023-11-03T18:04:40.6983230Z             f.seek(0)
2023-11-03T18:04:40.6983837Z             return f
2023-11-03T18:04:40.6984440Z     
2023-11-03T18:04:40.6985117Z >       new_clf = joblib.load(get_joblib_pickle_non_native_endianness())
2023-11-03T18:04:40.6985813Z 
2023-11-03T18:04:40.6987362Z NonNativeEndiannessNumpyPickler = <class 'sklearn.tree.tests.test_tree.test_different_endianness_joblib_pickle.<locals>.NonNativeEndiannessNumpyPickler'>
2023-11-03T18:04:40.6989137Z X          = array([[-0.03926799,  0.13191176, -0.21120598, ...,  1.97698901,
2023-11-03T18:04:40.6990168Z          1.02122474, -0.46931074],
2023-11-03T18:04:40.6990967Z        [ 0.7741606...794,  1.20985013],
2023-11-03T18:04:40.6993596Z        [-1.58249448, -1.42279491, -0.56430103, ...,  1.26661394,
2023-11-03T18:04:40.6994572Z         -1.31771734,  1.61805427]])
2023-11-03T18:04:40.6995380Z clf        = DecisionTreeClassifier(max_depth=3, random_state=0)
2023-11-03T18:04:40.6996705Z get_joblib_pickle_non_native_endianness = <function test_different_endianness_joblib_pickle.<locals>.get_joblib_pickle_non_native_endianness at 0x000001FC83C47250>
2023-11-03T18:04:40.6997937Z score      = 0.96
2023-11-03T18:04:40.6998672Z y          = array([0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1,
2023-11-03T18:04:40.6999534Z        0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1,...1,
2023-11-03T18:04:40.7000337Z        1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1,
2023-11-03T18:04:40.7001246Z        0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0])
2023-11-03T18:04:40.7001846Z 
2023-11-03T18:04:40.7003029Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\sklearn\tree\tests\test_tree.py�[0m:2124: 
2023-11-03T18:04:40.7004139Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-11-03T18:04:40.7005337Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\numpy_pickle.py�[0m:648: in load
2023-11-03T18:04:40.7006385Z     obj = _unpickle(fobj)
2023-11-03T18:04:40.7007212Z         filename   = ''
2023-11-03T18:04:40.7007948Z         fobj       = <_io.BytesIO object at 0x000001FCFC118450>
2023-11-03T18:04:40.7008734Z         mmap_mode  = None
2023-11-03T18:04:40.7009802Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\numpy_pickle.py�[0m:577: in _unpickle
2023-11-03T18:04:40.7010811Z     obj = unpickler.load()
2023-11-03T18:04:40.7011457Z         filename   = ''
2023-11-03T18:04:40.7012154Z         fobj       = <_io.BytesIO object at 0x000001FCFC118450>
2023-11-03T18:04:40.7013269Z         mmap_mode  = None
2023-11-03T18:04:40.7013939Z         obj        = None
2023-11-03T18:04:40.7014746Z         unpickler  = <joblib.numpy_pickle.NumpyUnpickler object at 0x000001FC838C7A00>
2023-11-03T18:04:40.7015882Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\pickle.py�[0m:1213: in load
2023-11-03T18:04:40.7017058Z     dispatch[key[0]](self)
2023-11-03T18:04:40.7018623Z         dispatch   = {40: <function _Unpickler.load_mark at 0x000001FCE3670940>, 41: <function _Unpickler.load_empty_tuple at 0x000001FCE36...: <function _Unpickler.load_stop at 0x000001FCE36709D0>, 48: <function _Unpickler.load_pop at 0x000001FCE3670040>, ...}
2023-11-03T18:04:40.7021702Z         key        = b'b'
2023-11-03T18:04:40.7022951Z         read       = <bound method _Unframer.read of <pickle._Unframer object at 0x000001FC838C4D00>>
2023-11-03T18:04:40.7024394Z         self       = <joblib.numpy_pickle.NumpyUnpickler object at 0x000001FC838C7A00>
2023-11-03T18:04:40.7026915Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\numpy_pickle.py�[0m:415: in load_build
2023-11-03T18:04:40.7028623Z     self.stack.append(array_wrapper.read(self))
2023-11-03T18:04:40.7029645Z         array_wrapper = <joblib.numpy_pickle.NumpyArrayWrapper object at 0x000001FC838C66E0>
2023-11-03T18:04:40.7031065Z         self       = <joblib.numpy_pickle.NumpyUnpickler object at 0x000001FC838C7A00>
2023-11-03T18:04:40.7032478Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\numpy_pickle.py�[0m:252: in read
2023-11-03T18:04:40.7033479Z     array = self.read_array(unpickler)
2023-11-03T18:04:40.7034340Z         self       = <joblib.numpy_pickle.NumpyArrayWrapper object at 0x000001FC838C66E0>
2023-11-03T18:04:40.7035357Z         unpickler  = <joblib.numpy_pickle.NumpyUnpickler object at 0x000001FC838C7A00>
2023-11-03T18:04:40.7036618Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\numpy_pickle.py�[0m:191: in read_array
2023-11-03T18:04:40.7037874Z     return _ensure_native_byte_order(array)
2023-11-03T18:04:40.7038918Z         array      = array([0, 1], dtype='>i8')
2023-11-03T18:04:40.7039709Z         count      = np.int64(2)
2023-11-03T18:04:40.7040551Z         i          = 0
2023-11-03T18:04:40.7041675Z         max_read_count = 32768
2023-11-03T18:04:40.7042382Z         numpy_array_alignment_bytes = 16
2023-11-03T18:04:40.7043151Z         padding_byte = b'\x01'
2023-11-03T18:04:40.7043995Z         padding_length = 1
2023-11-03T18:04:40.7044624Z         read_count = np.int64(2)
2023-11-03T18:04:40.7045296Z         read_size  = 16
2023-11-03T18:04:40.7046083Z         self       = <joblib.numpy_pickle.NumpyArrayWrapper object at 0x000001FC838C66E0>
2023-11-03T18:04:40.7046928Z         shape_int64 = [np.int64(2)]
2023-11-03T18:04:40.7047945Z         unpickler  = <joblib.numpy_pickle.NumpyUnpickler object at 0x000001FC838C7A00>
2023-11-03T18:04:40.7049191Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-11-03T18:04:40.7049918Z 
2023-11-03T18:04:40.7050581Z array = array([0, 1], dtype='>i8')
2023-11-03T18:04:40.7051105Z 
2023-11-03T18:04:40.7051704Z     def _ensure_native_byte_order(array):
2023-11-03T18:04:40.7052615Z         """Use the byte order of the host while preserving values
2023-11-03T18:04:40.7053299Z     
2023-11-03T18:04:40.7053915Z         Does nothing if array already uses the system byte order.
2023-11-03T18:04:40.7054681Z         """
2023-11-03T18:04:40.7055241Z         if _is_numpy_array_byte_order_mismatch(array):
2023-11-03T18:04:40.7055978Z >           array = array.byteswap().newbyteorder('=')
2023-11-03T18:04:40.7057264Z �[1m�[31mE           AttributeError: `newbyteorder` was removed from the ndarray class in NumPy 2.0. Use `arr.view(arr.dtype.newbyteorder(order))` instead.�[0m
2023-11-03T18:04:40.7058249Z 
2023-11-03T18:04:40.7058907Z array      = array([0, 1], dtype='>i8')
2023-11-03T18:04:40.7059465Z 
2023-11-03T18:04:40.7060411Z �[1m�[31mC:\Miniconda\envs\testvenv\lib\site-packages\joblib\numpy_pickle_utils.py�[0m:72: AttributeError
2023-11-03T18:04:40.7061633Z -------------- generated xml file: D:\a\tmp_folder\test-data.xml --------------
2023-11-03T18:04:40.7062610Z ============================ slowest 20 durations =============================
2023-11-03T18:04:40.7063689Z 11.93s setup    metrics/_plot/tests/test_common_curve_display.py::test_display_curve_error_classifier[CalibrationDisplay]
2023-11-03T18:04:40.7064895Z 5.46s call     model_selection/tests/test_validation.py::test_permutation_test_score_allow_nans
2023-11-03T18:04:40.7066156Z 5.25s call     preprocessing/tests/test_target_encoder.py::test_fit_transform_not_associated_with_y_if_ordinal_categorical_is_not[7]
2023-11-03T18:04:40.7067604Z 4.82s call     utils/tests/test_estimator_checks.py::test_check_estimator_clones
2023-11-03T18:04:40.7068849Z 4.55s call     experimental/tests/test_enable_iterative_imputer.py::test_imports_strategies
2023-11-03T18:04:40.7069940Z 4.38s call     manifold/tests/test_t_sne.py::test_tsne_with_mahalanobis_distance
2023-11-03T18:04:40.7071508Z 4.34s call     experimental/tests/test_enable_successive_halving.py::test_imports_strategies
2023-11-03T18:04:40.7074664Z 4.29s call     decomposition/tests/test_sparse_pca.py::test_transform_inverse_transform_round_trip[MiniBatchSparsePCA]
2023-11-03T18:04:40.7076026Z 4.05s call     linear_model/tests/test_sgd.py::test_multi_core_gridsearch_and_early_stopping
2023-11-03T18:04:40.7077519Z 3.91s call     decomposition/tests/test_dict_learning.py::test_sparse_coder_parallel_mmap
2023-11-03T18:04:40.7078765Z 3.74s call     model_selection/tests/test_search.py::test_random_search_bad_cv
2023-11-03T18:04:40.7079878Z 3.57s call     utils/tests/test_parallel.py::test_configuration_passes_through_to_joblib[multiprocessing-2]
2023-11-03T18:04:40.7080921Z 3.46s call     ensemble/tests/test_bagging.py::test_estimator
2023-11-03T18:04:40.7081791Z 3.17s call     feature_selection/tests/test_rfe.py::test_rfe_cv_groups
2023-11-03T18:04:40.7082804Z 3.17s call     decomposition/tests/test_dict_learning.py::test_cd_work_on_joblib_memmapped_data
2023-11-03T18:04:40.7083890Z 3.16s call     tests/test_config.py::test_config_threadsafe_joblib[multiprocessing]
2023-11-03T18:04:40.7084881Z 3.10s call     utils/tests/test_estimator_checks.py::test_check_estimator
2023-11-03T18:04:40.7085806Z 2.94s call     neural_network/tests/test_mlp.py::test_n_iter_no_change_inf
2023-11-03T18:04:40.7086740Z 2.79s call     utils/tests/test_multiclass.py::test_unique_labels_mixed_types
2023-11-03T18:04:40.7087869Z 2.66s call     feature_selection/tests/test_sequential.py::test_n_features_to_select_stopping_criterion[forward]
2023-11-03T18:04:40.7089120Z �[36m�[1m=========================== short test summary info ===========================�[0m
2023-11-03T18:04:40.7090788Z �[31mFAILED�[0m decomposition/tests/test_dict_learning.py::�[1mtest_dict_learning_lassocd_readonly_data�[0m - _pickle.PicklingError: Could not pickle the task to send it to the workers.
2023-11-03T18:04:40.7093934Z �[31mFAILED�[0m linear_model/tests/test_bayes.py::�[1mtest_dtype_match[BayesianRidge-float32]�[0m - AssertionError: assert dtype('float64') == dtype('float32')
2023-11-03T18:04:40.7096694Z �[31mFAILED�[0m linear_model/tests/test_bayes.py::�[1mtest_dtype_match[ARDRegression-float32]�[0m - AssertionError: assert dtype('float64') == dtype('float32')
2023-11-03T18:04:40.7099194Z �[31mFAILED�[0m tree/tests/test_tree.py::�[1mtest_different_endianness_joblib_pickle�[0m - AttributeError: `newbyteorder` was removed from the ndarray class in NumPy ...
2023-11-03T18:04:40.7101264Z �[31m= �[31m�[1m4 failed�[0m, �[32m28786 passed�[0m, �[33m3461 skipped�[0m, �[33m90 xfailed�[0m, �[33m45 xpassed�[0m, �[33m2742 warnings�[0m�[31m in 710.59s (0:11:50)�[0m�[31m =�[0m
2023-11-03T18:04:42.9874632Z ##[error]Bash exited with code '1'.

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

@@ -16,10 +16,6 @@ cdef enum:
# 32-bit signed integers (i.e. 2^31 - 1).
RAND_R_MAX = 2147483647

cpdef sample_without_replacement(cnp.int_t n_population,
Copy link
Member

Choose a reason for hiding this comment

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

This would make sample_without_replacement not cimportable by other modules. Given that _random is a private module, I am okay with it's removal.

Comment on lines 321 to 322
# converting to long will allow conversion to integer (from float)
# via `int()`, but conversion from other objects does not.
Copy link
Member

Choose a reason for hiding this comment

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

A little bit of rewording from reading the code.

Suggested change
# converting to long will allow conversion to integer (from float)
# via `int()`, but conversion from other objects does not.
# converting to long via `int()` will allow conversion to
# `intp`, but conversion from other objects does not.

Is this consistent with what you intent to say?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried to tweak this and the other comments, maybe it helps. The point is the second branch does int() implicitly and is the old behavior. Cython doesn't do it implicitly in the first, so we do it explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turns out, this was a lot more confusing than I thought. Because the definitions changed in the Cython 3 definitions file, which was the actual cause for changing how the conversion happened.

I am changing it back in NumPy 1.26.2 (and a slightly more thorough fix for 2.0). So this will not be strictly necessary in the future (as the comment says).

(I actually prefer the strict version, but that is a separate discussion/transition.)

In either case, I hope the comment is relatively clear now.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @seberg!

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasjpfan thomasjpfan merged commit 0ab3699 into scikit-learn:main Nov 16, 2023
@seberg seberg deleted the default-int branch November 16, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants