This library offers you the possibility to evaluate many machine learning models at the same time,
using sk-learn and saving a lot of time and coding.
In this blog, we will see how we can use multiple models at once for prediction using Lazy Predict library.
- CLASSIFICATION MODELS
- CLASSIFICATION MODELS
CLASSIFICATION MODELS
First, you need to install the library
# Installation pip install lazypredict
# Imports from lazypredict.Supervised import LazyClassifier from sklearn.model_selection import train_test_split import pandas as pd from sklearn import datasets
# Load our toy dataset df = datasets.load_breast_cancer() type(df)
# Transform to Pandas dataframe if you want to explore the data df2 = pd.DataFrame( df.data , columns=df.feature_names) df2['target'] = df.target df2.head()
# X and Y X, y = df.data, df.target
# Train Test Split X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.2,random_state=12)
Here is where the magic happens:
# Fit all models clf = LazyClassifier(predictions=True) models, predictions = clf.fit(X_train, X_test, y_train, y_test) models
REGRESSION MODELS
from lazypredict.Supervised import LazyRegressor
# Load toy dataset boston = datasets.load_boston()
# X and y split X, y = boston.data, boston.target X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=.2,random_state=12)
# Fit all regression models reg = LazyRegressor(predictions=True) models, predictions = reg.fit(X_train, X_test, y_train, y_test) models
Great post. I am experiencing a few of these issues as well..
I’ve read some just right stuff here. Definitely value bookmarking for revisiting. I wonder how a lot effort you set to create this sort of wonderful informative website.
I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire
someone to do it for you? Plz answer back as I’m looking to design my own blog and would
like to find out where u got this from. thank you
It’s in fact very difficult in this active life to listen news on TV,
so I only use web for that purpose, and obtain the hottest news.
When someone writes an article he/she keeps the idea of a user in his/her mind that how a user can know it. So that’s why this post is great. Thanks!