Lightweight save/load #673
Replies: 3 comments 2 replies
-
Hi! Indeed training data are pickled but not used in prediction, so you can do something like: sm = KRG()
sm.set_training_values(X_train, y_train)
sm.train()
sm.training_points = {} # hack: remove training data not used in prediction
with open("krg.pickle", "wb") as handle:
pickle.dump(sm, handle) Let me know if it works for you and how much it decreases the size on disk |
Beta Was this translation helpful? Give feedback.
-
Actually I should have done the maths, kriging memory cost is in N^2 where N is the number of training points. In your case it explains the 1% decrease as you have just removed ~N (=100). |
Beta Was this translation helpful? Give feedback.
-
You can also try Once you have installed from smt.surrogate_models import GPX
sm = GPX()
sm.set_training_values(xt, yt)
sm.train()
sm.save("sm.bin")
sm2 = GPX.load("sm.bin")
ynew = sm2.predict_values(xnew) |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm trying to save (pickle) a set of about 10,000 small
KRG
surrogate models (~100 training points each), however, the size on disk is huge (>10 GB).Is there a way of lightweighting a surrogate model object (e.g., get rid of the training data) to reduce the size on disk?
Training this batch of models takes about 5 hours, so the surrogate is not very useful unless there is a way of saving/loading the models in a way that is shareable.
- Ed Alvarez
Beta Was this translation helpful? Give feedback.
All reactions