EpistasisLab / EpistasisLab/tpot
Dynamic classes cause PicklingError
- Dominant language
- Jupyter Notebook
- Stars
- 10.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
I tried to pickle a TPOTRegressor and had this Exception:
PicklingError: Can't pickle : attribute lookup RandomForestRegressor__bootstrap on tpot.operator_utils failed
It seems pickle has issues with dynamically created classes, probably from [TPOTOperatorClassFactory](https://github.com/EpistasisLab/tpot/blob/master/tpot/operator_utils.py#L130) and [ARGTypeClassFactory](https://github.com/EpistasisLab/tpot/blob/master/tpot/operator_utils.py#L109).
According to the documentation of pickle, it is sufficient to write a [__reduce__](https://docs.python.org/3/library/pickle.html#object.__reduce__) method that reconstructs the object, which is not very easy.
Another possibility would be not to use those dynamic classes. In the past I have done similar things, and in the end dynamic classes have always been been a bad idea.
The TPOTOperatorClassFactory seems a bit complicated, but could you explain to me why a ARGTypeClassFactory is used?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.