What Is The Recommended Way To Persist (pickle) Custom Sklearn Pipelines?
I have built an sklearn pipeline that combines a standard support vector regression component with some custom transformers that create features. This pipeline is then put into an
Solution 1:
OK, after some googling around it seems to be the case that the root cause is not pickling, it is simply a pyinstaller "hidden imports" issue, but for some reason it only shows up when pickling (don't ask me why).
The following solved the immediate issue for me: edit the .spec
file to add the following hidden import with Scipy
:
hiddenimports=['scipy._lib.messagestream']
I also needed some other hidden imports related to other libraries
hiddenimports=['sklearn.neighbors.typedefs',
'scipy._lib.messagestream',
'pandas._libs.tslibs.timedeltas' ]
Solution 2:
If anyone just wants to do this via CLI argument instead of through the .spec file as presented in Roko's answer, this is the syntax:
pyinstaller --hidden-import scipy._lib.messagestream --onefile your_python_file_here.py
Post a Comment for "What Is The Recommended Way To Persist (pickle) Custom Sklearn Pipelines?"