1# fit the model
2model.fit(X_train, y_train)
3
4# save the model
5import pickle
6pickle.dump(model, open("model.pkl", "wb"))
7
8# load the model
9model = pickle.load(open("model.pkl", "rb"))
10
11# use model to predict
12y_pred = model.predict(X_input)
1model.fit(X_train, Y_train)
2# save the model to disk
3filename = 'finalized_model.sav'
4pickle.dump(model, open(filename, 'wb'))
5
6# load the model from disk
7loaded_model = pickle.load(open(filename, 'rb'))
8result = loaded_model.score(X_test, Y_test)