What is the recommended way to save (brine) custom sklearn pipelines?

I built the sklearn protocol , which combines the standard component of vector support regression with some custom transformers that create functions. This pipeline is then placed in an object that is trained and then pickled ( this is apparently recommended). A continuous object is used for forecasting.

For distribution, it turns into an executable with pyinstaller .

When I call an unpainted regression object from unit test, it works fine.

However, when I try to use the PyInstaller binary to make forecasts, I get a long stack trace that ends with:

module = loader.load_module(fullname)   File "messagestream.pxd", line 5, in init scipy.optimize._trlib._trlib ImportError: No module named 'scipy._lib.messagestream'

This looks like some kind of etching error, possibly due to the interaction of etching with pyinstaller. How can I reorganize my code so that my custom pipeline works as easily and reliably as standard sklearn regression after spilling?

+2
source share
1 answer

OK, after some searching around the world, it seems that the main reason is not etching, it is just a problem with the hidden pyinstaller import, but for some reason it only appears when etching (don't ask me why).

: .spec, Scipy:

 hiddenimports=['scipy._lib.messagestream']

,

 hiddenimports=['sklearn.neighbors.typedefs',
                'scipy._lib.messagestream',
                'pandas._libs.tslibs.timedeltas'   ]
+4

Source: https://habr.com/ru/post/1688527/


All Articles