Save Model
Saving a trained model in PyCaret is as simple as writing save_model. The function takes a trained model object and saves the entire transformation pipeline and trained model object as a transferable binary pickle file for later use.
Example
Code
# Importing dataset from pycaret.datasets import get_data diabetes = get_data('diabetes') # Importing module and initializing setup from pycaret.classification import * clf1 = setup(data = diabetes, target = 'Class variable') # create a model dt = create_model('dt') # save a model save_model(dt, 'dt_saved_07032020')
Output
Loading saved model
Code
# Loading the saved model dt_saved = load_model('dt_saved_07032020')
Output
Try this next
Was this page helpful?
GitHub