Below is a minimal working example. This is a tiny representation of my problem and not nearly as complex as what I actually have to work with.
Suppose I have a class with a few complex objects contained within the class, like sci-kit learn classes. I know that I can save the objects like this:
from sklearn.linear_model import LinearRegression
from joblib import dump, load
class SeveralPickels:
def __init__(self):
self.lm1 = LinearRegression()
self.lm2 = LinearRegression()
def save(self):
dump(self.lm1, f'lm1.joblib')
dump(self.lm2, f'lm2.joblib')
def load(self):
self.lm1 = load(f'lm1.joblib')
self.lm2 = load(f'lm2.joblib')
sp = SeveralPickels()
sp.save()
sp2 = SeveralPickels()
sp2.load()
What I would really like to do is save both(read many) of the objects to the same file, in some way. Why? Because the class that I actually want to do something like this on has several complex, yet completely picklable/joblib.dumpable objects. I've thought about using hdf5, but that seems to prefer numerical data, not objects. What would be a good way to do a thing like this, or do I have to grit my teeth and bear having to save/load from several files?