Closed
Description
Describe the bug
Spotted in scikit-lego, running check_estimators_pickle
fails with SplineTransformer
and readonly_memmap=True
.
cc: @koaning
Steps/Code to Reproduce
from sklearn.utils.estimator_checks import check_estimators_pickle
from sklearn.preprocessing import SplineTransformer
check_estimators_pickle(
name="hello",
estimator_orig=SplineTransformer(),
readonly_memmap=True,
)
Expected Results
Not to raise
Actual Results
Traceback (most recent call last):
File "/home/fbruzzesi/open-source/scikit-lego/t.py", line 5, in <module>
check_estimators_pickle(
File "/home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/sklearn/utils/_testing.py", line 147, in wrapper
return fn(*args, **kwargs)
File "/home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/sklearn/utils/estimator_checks.py", line 2354, in check_estimators_pickle
unpickled_result = getattr(unpickled_estimator, method)(X)
File "/home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/sklearn/utils/_set_output.py", line 319, in wrapped
data_to_wrap = f(self, X, *args, **kwargs)
File "/home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/sklearn/preprocessing/_polynomial.py", line 1036, in transform
f_min, f_max = spl(xmin), spl(xmax)
File "/home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/scipy/interpolate/_bsplines.py", line 523, in __call__
_dierckx.evaluate_spline(self.t, cc.reshape(cc.shape[0], -1),
ValueError: Expected a 1-dim C contiguous array of dtype = 12( got 12 )
Versions
System:
python: 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0]
machine: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
Python dependencies:
sklearn: 1.6.0
pip: 24.1
setuptools: None
numpy: 2.2.0
scipy: 1.15.0rc1
Cython: None
pandas: 2.2.3
matplotlib: None
joblib: 1.4.2
threadpoolctl: 3.5.0
Built with OpenMP: True
threadpoolctl info:
user_api: blas
internal_api: openblas
num_threads: 12
prefix: libscipy_openblas
filepath: /home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/numpy.libs/libscipy_openblas64_-6bb31eeb.so
version: 0.3.28
threading_layer: pthreads
architecture: Haswell
user_api: blas
internal_api: openblas
num_threads: 12
prefix: libscipy_openblas
filepath: /home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/scipy.libs/libscipy_openblas-68440149.so
version: 0.3.28
threading_layer: pthreads
architecture: Haswell
user_api: openmp
internal_api: openmp
num_threads: 12
prefix: libgomp
filepath: /home/fbruzzesi/open-source/scikit-lego/.venv-pre/lib/python3.10/site-packages/scikit_learn.libs/libgomp-a34b3233.so.1.0.0
version: None