PyCaret

3.3.2 · active · verified Wed Apr 15

PyCaret is an open-source, low-code machine learning library in Python that streamlines end-to-end machine learning workflows, from data preparation to model deployment. It is currently at version 3.3.2 and maintains an active release schedule, frequently delivering minor updates for bug fixes and dependency compatibility, alongside significant major releases that introduce new features and breaking API changes. [1, 13, 14, 15]

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a typical PyCaret classification workflow using the functional API. It involves loading a dataset, initializing the environment with `setup()`, comparing multiple models with `compare_models()`, making predictions, and saving the best performing model. [1, 7, 10, 11]

import pandas as pd
from pycaret.datasets import get_data
from pycaret.classification import *

# Load a sample dataset
data = get_data('diabetes')

# Initialize the setup (classification experiment)
# Use silent=True for non-interactive environments and session_id for reproducibility
clf1 = setup(data=data, target='Class variable', session_id=123, silent=True)

# Compare all available models and select the best one
best_model = compare_models()

# Make predictions on the hold-out set
predictions = predict_model(best_model)

# Save the trained model pipeline
save_model(best_model, 'diabetes_best_pipeline')

view raw JSON →