healthcareai-py
healthcareai-py copied to clipboard
Save python & library version metadata w/ pickled model
Background
Pickling is dangerous because it assumes the exact environment when objects are deserialized from disk.
A real solution would be to save a model in an environmental agnostic way, such as JSON. This is nontrivial to do. Therefore, MVP first:
MVP
When a model is saved (as a pickled TrainedSupervisedModel), also save a .json (preferable) or .txt file describing the following:
- The python version
- The version of healthcare.ai
- The versions of all installed libraries (think pip freeze here)
Implementation Notes
- This file should have the same filename (except extension) as the saved model.
This finally struck and caused me to lose 2-3 hours on client work.
This is a small amount of work and the output from pip freeze
and python --version
should easily suffice.