Closed jmrichardson closed 2 years ago
Hi @jmrichardson,
I think joblib / pickle is limited as it cannot serialize functions / closures that are defined in local scope (as we do in the constructor). A solution for this is to use dill instead of pickle / joblib to serialize your feature selector.
In [9]: import dill
In [10]: with open("test.pkl", "wb") as f:
...: dill.dump(selector, f, recurse=True)
FYI: this is what we do under the hood in tsflex (see here). I might add a .serialize()
method to PowerShap as well
Hi @jvdd ,
Yes, thank you, I did see that Dill is a solution for this problem. Unfortunately, my framework uses joblib's memory to cache my class methods which uses pickle under the hood. However, I was able to work around the problem not caching the fit and instead caching the transform feature columns. I am going to close this issue as I don't see this as a powershap issue.
Tsflex is next on my list to checkout in the future. I really appreciate the libraries you offer and keep up the great work! :)
Hi,
With version 0.0.7 I am receiving the following error when trying to pickle (ie joblib):
Powershap work's great, it's just saving the fit for future use with pickle that is the problem. I have to use pickle as it's part of joblib which is caching my functions using "memory".
Here's a reproduceable example:
Thanks in advance for any help.
*** Update: this is not a major issue. Worked around the problem by storing the feature names vs the fit and happy to close issue if this is not something that is a priority.