1import pickle
2
3# save the model to disk
4filename = 'finalized_model.sav'
5pickle.dump(model, open(filename, 'wb'))
6
7# some time later...
8
9# load the model from disk
10loaded_model = pickle.load(open(filename, 'rb'))
11result = loaded_model.score(X_test, Y_test)
12print(result)