shankarpandala/lazypredict
Python AutoML toolkit for benchmarking classification, regression, and time-series forecasting models, with GPU acceleration, MLflow tracking, and automated preprocessing.
What it is
Lazy Predict is a Python library that automatically builds and evaluates many machine-learning models with very little code. Instead of manually trying different algorithms and tuning their settings, you give it your data and it runs a large batch of models, then returns a comparison table showing which ones perform best. It's designed for quick "sanity checks" — understanding which model families are promising before you invest time in detailed tuning.
It's free software under the MIT license, with documentation at https://shankarpandala.github.io/lazypredict/.
What it does
- Runs 40+ built-in models for classification and regression automatically.
- Also handles time-series forecasting with 20+ models: statistical (e.g., ETS, ARIMA, Theta), machine learning (Random Forest, XGBoost, etc.), deep learning (LSTM, GRU), and pretrained foundation models (TimesFM).
- Auto-detects seasonal patterns in time series using ACF (autocorrelation function), or lets you override the seasonal period manually.
- Handles categorical features with several encoding strategies: one-hot, ordinal, target, and binary.
- Tracks experiments via built-in MLflow integration.
- Supports GPU acceleration for models like XGBoost, LightGBM, CatBoost, cuML (RAPIDS), LSTM/GRU, and TimesFM — with automatic fallback to CPU if no GPU is available.
- Works on Python 3.10 through 3.14.
- Allows custom evaluation metrics, configurable per-model timeouts, and cross-validation.
- Optional Intel Extension for Scikit-learn acceleration (opt-in).
Installation
pip install lazypredict
or via conda:
conda install -c conda-forge lazypredict
Optional extras (pip only):
lazypredict[boost]— adds XGBoost, LightGBM, CatBoostlazypredict[encoders]— addscategory-encodersfor target/binary encodinglazypredict[timeseries]— adds statsmodels + pmdarima for time-serieslazypredict[timeseries,deeplearning]— adds LSTM/GRU via PyTorchlazypredict[timeseries,foundation]— adds Google TimesFMlazypredict[all]— everything
How you use it
Classification
from lazypredict.Supervised import LazyClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
data = load_breast_cancer()
X, y = data.data, data.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=123)
clf = LazyClassifier(verbose=0, ignore_warnings=True, custom_metric=None)
models, predictions = clf.fit(X_train, X_test, y_train, y_test)
print(models)
The output is a table ranking models by metrics like Accuracy, ROC AUC, F1 Score, and time taken. You can pass options like categorical_encoder='onehot', timeout=60 (max seconds per model), cv=5 (cross-validation folds), and use_gpu=True.
Regression
from lazypredict.Supervised import LazyRegressor
from sklearn import datasets
from sklearn.utils import shuffle
import numpy as np
diabetes = datasets.load_diabetes()
X, y = shuffle(diabetes.data, diabetes.target, random_state=13)
X = X.astype(np.float32)
offset = int(X.shape[0] * 0.9)
X_train, y_train = X[:offset], y[:offset]
X_test, y_test = X[offset:], y[offset:]
reg = LazyRegressor(verbose=0, ignore_warnings=False, custom_metric=None)
models, predictions = reg.fit(X_train, X_test, y_train, y_test)
print(models)
Output ranks models by Adjusted R-Squared, R-Squared, RMSE, and time. Same options as classification (encoding, timeout, GPU, etc.).
Time-series forecasting
from lazypredict.TimeSeriesForecasting import LazyForecaster
import numpy as np
np.random.seed(42)
t = np.arange(200)
rng = np.random.default_rng(42)
y = 10 + 0.05 * t + 3 * np.sin(2 * np.pi * t / 12) + rng.normal(0, 1, 200)
y_train, y_test = y[:180], y[180:]
fcst = LazyForecaster(verbose=0, ignore_warnings=True)
scores, predictions = fcst.fit(y_train, y_test)
print(scores)
Output ranks forecasting models by MAE, RMSE, MAPE, SMAPE, MASE, R-Squared, and time. You can also pass exogenous variables (extra features) and options like seasonal_period, cv, timeout, sort_by, forecasters (list or "all"), max_models, n_lags, n_rolling, and foundation_model_path (for offline TimesFM weights).
GPU acceleration
Set use_gpu=True in any of the three classes. Supported backends:
- XGBoost —
device="cuda" - LightGBM —
device="gpu" - CatBoost —
task_type="GPU" - cuML (RAPIDS) — GPU-native scikit-learn replacements (auto-discovered when installed)
- LSTM / GRU — PyTorch CUDA
- TimesFM — PyTorch CUDA
If no GPU is available, it automatically falls back to CPU.
Key parameters (shared across classes)
verbose(0 or 1) — silent or show progressignore_warnings— suppress warnings/errorscustom_metric— your own evaluation functionpredictions— return a DataFrame of predictionscategorical_encoder—'onehot','ordinal','target','binary'(target/binary needcategory-encoders)timeout— max seconds per model; slow models are interrupted on Linux/macOS and listed inerrorsasTimeoutExceptioncv— number of cross-validation folds (None to disable)use_gpu— enable GPU acceleration (default False)
What it's not
It doesn't tune hyperparameters — it runs each model with default settings to give you a quick baseline comparison. The README explicitly says it helps "understand which models work better without any parameter tuning."
Related
- Project
- Project
- Project
- Project
- Project