What are set config, save config, and load config in PyCaret?

The purpose of this recipe is to demonstrate how to use set config, save config and load config functions in PyCaret through examples.

Recipe Objective - What are set_config, save_config, and load_config in the classification model in PyCaret?

PyCaret provides set_config, save_config, and load_config functions in the classification module.

For more related projects:

https://www.projectpro.io/article/7-types-of-classification-algorithms-in-machine-learning/435

https://www.projectpro.io/projects/data-science-projects/keras-deep-learning-projects

set_config function with Example:

PyCaret provides "pycaret.classification.set_config()" function. set_config function resets the global variables.

List of Classification Algorithms in Machine Learning

Some Accessible variables:

X: Transformed dataset (X)

y: Transformed dataset (y)

X_train: Transformed train dataset (X)

X_test: Transformed test/holdout dataset (X)

y_train: Transformed train dataset (y)

y_test: Transformed test/holdout dataset (y)

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
# initialize setup
setup_name = setup(data = iris, target = 'species')
set_config('seed', 123)

save_config function with Example:

PyCaret provides "pycaret.classification.save_config()" function.

save_config function saves all global variables to a pickle file, allowing to resume without rerunning the setup later.

from pycaret.datasets import get_data
iris = get_data('iris')
# importing classification module
from pycaret.classification import *
# initialize setup
setup_name = setup(data = iris, target = 'species')
# saving our model
save_config('my_pycaret_model.pkl')

load_config function with Example:

PyCaret provides "pycaret.classification.load_config()" function.

load_config function loads global variables from a pickle file into Python environment.

from pycaret.classification import load_config
# "my_pycaret_model is already been saved"
load_config('my_pycaret_model.pkl')

What Users are saying..

profile image

Savvy Sahai

Data Science Intern, Capgemini
linkedin profile url

As a student looking to break into the field of data engineering and data science, one can get really confused as to which path to take. Very few ways to do it are Google, YouTube, etc. I was one of... Read More

Relevant Projects

Text Classification with Transformers-RoBERTa and XLNet Model
In this machine learning project, you will learn how to load, fine tune and evaluate various transformer models for text classification tasks.

MLOps using Azure Devops to Deploy a Classification Model
In this MLOps Azure project, you will learn how to deploy a classification machine learning model to predict the customer's license status on Azure through scalable CI/CD ML pipelines.

Deploy Transformer-BART Model on Paperspace Cloud
In this MLOps Project you will learn how to deploy a Tranaformer BART Model for Abstractive Text Summarization on Paperspace Private Cloud

Census Income Data Set Project-Predict Adult Census Income
Use the Adult Income dataset to predict whether income exceeds 50K yr based oncensus data.

Learn Hyperparameter Tuning for Neural Networks with PyTorch
In this Deep Learning Project, you will learn how to optimally tune the hyperparameters (learning rate, epochs, dropout, early stopping) of a neural network model in PyTorch to improve model performance.

Build Piecewise and Spline Regression Models in Python
In this Regression Project, you will learn how to build a piecewise and spline regression model from scratch in Python to predict the points scored by a sports team.

AWS MLOps Project for ARCH and GARCH Time Series Models
Build and deploy ARCH and GARCH time series forecasting models in Python on AWS .

Learn to Build an End-to-End Machine Learning Pipeline - Part 2
In this Machine Learning Project, you will learn how to build an end-to-end machine learning pipeline for predicting truck delays, incorporating Hopsworks' feature store and Weights and Biases for model experimentation.

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

Build Deep Autoencoders Model for Anomaly Detection in Python
In this deep learning project , you will build and deploy a deep autoencoders model using Flask.