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.
# 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')
Loading saved model
# Loading the saved model dt_saved = load_model('dt_saved_07032020')
Try this next
Was this page helpful?