Save Model
Sayyam-Shah opened this issue · 2 comments
Sayyam-Shah commented
Hello,
How do you recommend we save the model object in the tutorials?
cdpolt commented
@Sayyam-Shah how did you figure out how to save the results? i am also curious!
tobylanser commented
@cdpolt I've been able to save & load the model with the below code:
import pickle
# assume 'model' is a trained machine learning model
# ...
# save the model to a pickle file
with open('model.pkl', 'wb') as f:
pickle.dump(model, f)
And to load model:
import pickle
# Open the file containing the pickled object in binary mode
with open('model.pkl', 'rb') as f:
# Load the pickled object from the file
model = pickle.load(f)
Thus far it seems to work fine!