You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

lazypredict

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazypredict

Lazy Predict help build a lot of basic models without much code and helps understand which models works better without any parameter tuning

0.2.16
PyPI
Maintainers
2

Lazy Predict

image Publish Documentation Status Downloads CodeFactor Citations

Lazy Predict helps build a lot of basic models without much code and helps understand which models work better without any parameter tuning.

Features

  • Over 40 built-in machine learning models
  • Automatic model selection for classification and regression
  • Built-in MLflow integration for experiment tracking
  • Support for Python 3.8 through 3.13
  • Custom metric evaluation support

Installation

To install Lazy Predict:

pip install lazypredict

Usage

To use Lazy Predict in a project:

import lazypredict

Classification

Example:

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 = data.data
y = 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)
ModelAccuracyBalanced AccuracyROC AUCF1 ScoreTime Taken
LinearSVC0.9894740.9875440.9875440.9894620.0150008
SGDClassifier0.9894740.9875440.9875440.9894620.0109992
MLPClassifier0.9859650.9869040.9869040.9859940.426
Perceptron0.9859650.9847970.9847970.9859650.0120046
LogisticRegression0.9859650.982690.982690.9859340.0200036
LogisticRegressionCV0.9859650.982690.982690.9859340.262997
SVC0.9824560.9799420.9799420.9824370.0140011
CalibratedClassifierCV0.9824560.9757280.9757280.9823570.0350015
PassiveAggressiveClassifier0.9754390.9744480.9744480.9754640.0130005
LabelPropagation0.9754390.9744480.9744480.9754640.0429988
LabelSpreading0.9754390.9744480.9744480.9754640.0310006
RandomForestClassifier0.971930.9695940.9695940.971930.033
GradientBoostingClassifier0.971930.9674860.9674860.9718690.166998
QuadraticDiscriminantAnalysis0.9649120.9662060.9662060.9650520.0119994
HistGradientBoostingClassifier0.9684210.9647390.9647390.9683870.682003
RidgeClassifierCV0.971930.9632720.9632720.9717360.0130029
RidgeClassifier0.9684210.9605250.9605250.9682420.0119977
AdaBoostClassifier0.9614040.9592450.9592450.9614440.204998
ExtraTreesClassifier0.9614040.9571380.9571380.9613620.0270066
KNeighborsClassifier0.9614040.955030.955030.9612760.0560005
BaggingClassifier0.9473680.9545770.9545770.9478820.0559971
BernoulliNB0.9508770.9510030.9510030.9510720.0169988
LinearDiscriminantAnalysis0.9614040.9508160.9508160.9610890.0199995
GaussianNB0.9543860.9495360.9495360.9543370.0139935
NuSVC0.9543860.9432150.9432150.9540140.019989
DecisionTreeClassifier0.9368420.9336930.9336930.9369710.0170023
NearestCentroid0.9473680.9335060.9335060.9468010.0160074
ExtraTreeClassifier0.9228070.9121680.9121680.9224620.0109999
CheckingClassifier0.3614040.50.50.1918790.0170043
DummyClassifier0.5122810.4895980.4895980.5189240.0119965

Regression

Example:

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)
ModelAdjusted R-SquaredR-SquaredRMSETime Taken
ExtraTreesRegressor0.3789210.52007654.22020.121466
OrthogonalMatchingPursuitCV0.3749470.51700454.39340.0111742
Lasso0.3734830.51587354.4570.00620174
LassoLars0.3734740.51586654.45750.0087235
LarsCV0.37150.51434154.54320.0160234
LassoCV0.3704130.51350154.59030.0624897
PassiveAggressiveRegressor0.3669580.51083154.73990.00689793
LassoLarsIC0.3649840.50930654.82520.0108321
SGDRegressor0.3643070.50878354.85440.0055306
RidgeCV0.3630020.50777454.91070.00728202
Ridge0.3630020.50777454.91070.00556874
BayesianRidge0.3622960.50722954.94110.0122972
LassoLarsCV0.3617490.50680654.96460.0175984
TransformedTargetRegressor0.3617490.50680654.96460.00604773
LinearRegression0.3617490.50680654.96460.00677514
Lars0.3588280.50454955.09030.00935149
ElasticNetCV0.3561590.50248655.20480.0478678
HuberRegressor0.3552510.50178555.24370.0129263
RandomForestRegressor0.3496210.49743455.48440.2331
AdaBoostRegressor0.3404160.49032255.87570.0512381
LGBMRegressor0.3392390.48941255.92550.0396187
HistGradientBoostingRegressor0.3356320.48662556.07790.0897055
PoissonRegressor0.3230330.47688956.60720.00953603
ElasticNet0.3017550.46044757.48990.00604224
KNeighborsRegressor0.2998550.45897957.56810.00757337
OrthogonalMatchingPursuit0.2924210.45323557.87290.00709486
BaggingRegressor0.2912130.45230157.92230.0302746
GradientBoostingRegressor0.2470090.41814359.70110.136803
TweedieRegressor0.2442150.41598459.81180.00633955
XGBRegressor0.2242630.40056760.59610.339694
GammaRegressor0.2238950.40028360.61050.0235181
RANSACRegressor0.2035350.3845561.40040.0653253
LinearSVR0.1167070.31745564.66070.0077076
ExtraTreeRegressor0.002019020.22883368.73040.00626636
NuSVR-0.06670430.17572871.05750.0143399
SVR-0.09641280.15277272.04020.0114729
DummyRegressor-0.297553-0.0026547878.37010.00592971
DecisionTreeRegressor-0.470263-0.13611283.42290.00749898
GaussianProcessRegressor-0.769174-0.36708991.51090.0770502
MLPRegressor-1.86772-1.21597116.5080.235267
KernelRidge-5.03822-3.6659169.0610.0243919

MLflow Integration

Lazy Predict includes built-in MLflow integration. Enable it by setting the MLflow tracking URI:

import os
os.environ['MLFLOW_TRACKING_URI'] = 'sqlite:///mlflow.db'

# MLflow tracking will be automatically enabled
reg = LazyRegressor(verbose=0, ignore_warnings=True)
models, predictions = reg.fit(X_train, X_test, y_train, y_test)

Automatically tracks:

  • Model metrics (R-squared, RMSE, etc.)
  • Training time
  • Model parameters
  • Model artifacts

title: History

0.2.15 (2025-04-06)

  • Added MLflow integration for experiment tracking
  • Added support for Python 3.13
  • Updated all dependencies to latest versions
  • Improved model logging and tracking capabilities
  • Added automatic model signature logging with MLflow

0.2.11 (2022-02-06)

  • Updated the default version to 3.9

0.2.10 (2022-02-06)

  • Fixed issue with older version of Scikit-learn
  • Reduced dependencies sctrictly to few

0.2.8 (2021-02-06)

  • Removed StackingRegressor and CheckingClassifier.
  • Added provided_models method.
  • Added adjusted r-squared metric.
  • Added cardinality check to split categorical columns into low and high cardinality features.
  • Added different transformation pipeline for low and high cardinality features.
  • Included all number dtypes as inputs.
  • Fixed dependencies.
  • Improved documentation.

0.2.7 (2020-07-09)

  • Removed catboost regressor and classifier

0.2.6 (2020-01-22)

  • Added xgboost, lightgbm, catboost regressors and classifiers

0.2.5 (2020-01-20)

  • Removed troublesome regressors from list of CLASSIFIERS

0.2.4 (2020-01-19)

  • Removed troublesome regressors from list of REGRESSORS
  • Added feature to input custom metric for evaluation
  • Added feature to return predictions as dataframe
  • Added model training time for each model

0.2.3 (2019-11-22)

  • Removed TheilSenRegressor from list of REGRESSORS
  • Removed GaussianProcessClassifier from list of CLASSIFIERS

0.2.2 (2019-11-18)

  • Fixed automatic deployment issue.

0.2.1 (2019-11-18)

  • Release of Regression feature.

0.2.0 (2019-11-17)

  • Release of Classification feature.

0.1.0 (2019-11-16)

  • First release on PyPI.

Keywords

lazypredict

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts