Hey, hope you are having a wonderful day!

Whenever I work on a new ML project. These lines always pop up in my mind every time

“I need to fit the data for every model then apply metrics to check which model has better accuracy for the available dataset ,then choose best model and also this process is time-consuming and even it might not be that much effective too“

For this problem, I got a simple solution when surfing through python org, which is a small python library by name **“lazypredict” **and it does wonders

Let me tell you how it works:-

Install the library

pip install lazypredict

Note

  1. lazypredict only works for python version≥3.6
  2. It’s built on top of various other libraries so if you don’t have those libraries in the system, python will throw ModuleError so interpret the error properly and install the required libraries.

lazypredict comes only for supervised learning (Classification and Regression)

I will be using jupyter notebook in this article

Code

## import necessary modules
import warnings
warnings.filterwarnings('ignore')
import time 
from sklearn.datasets import load_iris,fetch_california_housing
from sklearn.model_selection import train_test_split
from lazypredict.Supervised import LazyClassifier,LazyRegressor
  • warnings: Package to handle warnings and ‘ignore’ is used when we need to filter out all the warnings
  • time: Package to handle time manipulation
  • sklearn.datasets: Package to load datasets, today we gonna use the classic datasets which everyone works on it that are load_iris() for classification problem and fetch_california_housing() for a regression problem
  • sklearn.model_selection.train_test_split:Used to split the dataset into train and split
  • lazypredict:this is the package we gonna learn today in lazypredict.Supervised there are two main functions LazyClassifier for Classification and LazyRegressor for Regression

#ai #data-science #deep-learning #python #machine-learning

Lazy Predict for ML Models
3.55 GEEK