• Latest
LazyPredict: A Utilitarian Python Library

LazyPredict: A Utilitarian Python Library

March 10, 2023
Video title: #shortvideo #freefire #subscribe #shortvideo #shorts #youtube #youtubeshorts #ytshorts🥺

Video title: #shortvideo #freefire #subscribe #shortvideo #shorts #youtube #youtubeshorts #ytshorts🥺

June 7, 2023
Super Mario Bros. Movie Physical Release Arrives In North America On 13th June

The Mario Movie Physical Release Is Already Available (North America)

June 7, 2023
ONLY YOU CAN SUCCESS YOURSELF ! || Motivational Speeches || IFFU MOTIVATIONAL .

ONLY YOU CAN SUCCESS YOURSELF ! || Motivational Speeches || IFFU MOTIVATIONAL .

June 7, 2023
Sifu's Free Arena Expansion Update Expected To Arrive On Switch Soon

Sifu's Free Arena Expansion Update Expected To Arrive On Switch Soon

June 7, 2023
Samsung Galaxy Z Fold5’s design revealed in leaked renders

It’s official: Samsung Galaxy Unpacked will be hosted in last week of July for unveiling of Fold5 and Flip5

June 7, 2023
papa #shortvideo

papa #shortvideo

June 7, 2023
Summer Game Fest 2023: How to Watch and What to Expect

Summer Game Fest 2023: How to Watch and What to Expect

June 7, 2023
My special talent!😱 #shortvideo #transition

My special talent!😱 #shortvideo #transition

June 7, 2023
Unveiling The Insane Capabilities Of The New VR Headset #shorts #apple

Unveiling The Insane Capabilities Of The New VR Headset #shorts #apple

June 7, 2023
This Phone Company is Racist 👀#shorts #podcast

This Phone Company is Racist 👀#shorts #podcast

June 7, 2023
Here’s what it’s like typing with Vision Pro and visionOS

Here’s what it’s like typing with Vision Pro and visionOS

June 7, 2023
‘Honkai Star Rail’ Release Date Announced for Mobile and PC, Coming to PS5 and PS4 Later – TouchArcade

‘Honkai Star Rail’ Version 1.1 – Galactic Roaming Featuring New Characters, Events, Stories, and a Lot More Is Out Now – TouchArcade

June 7, 2023
Advertise with us
Wednesday, June 7, 2023
Bookmarks
  • Login
  • Register
GetUpdated
  • Game Updates
  • Mobile Gaming
  • Playstation News
  • Xbox News
  • Switch News
  • MMORPG
  • Game News
  • IGN
  • Retro Gaming
  • Tech News
  • Apple Updates
  • Jailbreak News
  • Mobile News
  • Software Development
  • Photography
  • Contact
No Result
View All Result
GetUpdated
No Result
View All Result
GetUpdated
No Result
View All Result
ADVERTISEMENT

LazyPredict: A Utilitarian Python Library

March 10, 2023
in Software Development
Reading Time:6 mins read
0 0
0
Share on FacebookShare on WhatsAppShare on Twitter


Table of Contents

  • Introduction
  • Installation of the LazyPredict Module
  • Implementing LazyPredict in a Classification Model
  • Implementing LazyPredict in a Regression Model
  • Conclusion

Introduction

The development of machine learning models is being revolutionized by the state-of-the-art Python package known as LazyPredict. By using LazyPredict, we can quickly create a variety of fundamental models with little to no code, freeing up our time to choose the model that would work best with our data.

Model selection may be made easier using the library without requiring considerable parameter adjustment, which is one of its main benefits. LazyPredict offers a quick and effective way to find and fit the best models to our data.

Let’s explore and learn more about the usage of this library in this article.

Installation of the LazyPredict Module

Installation of the LazyPredict library is a pretty easy task. We need to use only one line of code as we usually do for installing any other Python library:

Implementing LazyPredict in a Classification Model

We’ll utilize the breast cancer dataset from the Sklearn package in this example.

Now, let’s load the data:

from sklearn.datasets import load_breast_cancer
from lazypredict.Supervised import LazyClassifier

data = load_breast_cancer()
X = data.data
y= data.target

To choose the best classifier model, let’s now deploy the “LazyClassifier” algorithm. These characteristics and input parameters apply to the class:

LazyClassifier(
    verbose=0,
    ignore_warnings=True,
    custom_metric=None,
    predictions=False,
    random_state=42,
    classifiers="all",
)

Let’s now apply it to our data and fit it:

from lazypredict.Supervised import LazyClassifier
from sklearn.model_selection import train_test_split

# split the data
X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.3,random_state =0)

# build the lazyclassifier
clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)

# fit it
models, predictions = clf.fit(X_train, X_test, y_train, y_test)

# print the best models
print(models)

The code above outputs:

Output 1

Output 22

Then, we may conduct the following to examine these models’ individual details:

model_dictionary = clf.provide_models(X_train,X_test,y_train,y_test)

Next, use the name of the model that interests us (let’s choose the best model) to determine precisely which steps were used:

model_dictionary['LGBMClassifier']

Output 3

Here, we can see that a SimpleImputer was used on the entire set of data, followed by a StandardScaler on the numerical features. There are no categorical or ordinal features in this dataset, but if there were, OneHotEncoder and OrdinalEncoder would have been used, respectively. The LGBMClassifier model receives the data after transformation and imputation.

LazyClassifier’s internal machine-learning models are evaluated and fitted using the sci-kit-learn toolkit. The LazyClassifier function automatically builds and fits a variety of models, including decision trees, random forests, support vector machines, and others, on our data when it is called. A set of performance criteria, like accuracy, recall, or F1 score, that you provide are then used to evaluate the models. The training set is used for fitting, while the test set is used for evaluation.

Following the models’ evaluation and fitting, LazyClassifier offers a summary of the findings (the table above), along with a list of the top models and performance metrics for each model. With no need for manual tweaking or model selection, you can quickly and simply evaluate the performance of many models and choose the best one for our data.

Implementing LazyPredict in a Regression Model

Using the “LazyRegressor” function, we can, once again, accomplish the same for regression models.

Let’s import a dataset that will be suitable for a regression task (Here, we can use the Boston dataset).

Let’s now fit our data to the LazyRegressor using it:

from lazypredict.Supervised import LazyRegressor
from sklearn import datasets
from sklearn.utils import shuffle
import numpy as np

# load the data
boston = datasets.load_boston()
X, y = shuffle(boston.data, boston.target, random_state=0)
X = X.astype(np.float32)

# split the data
X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.3,random_state =0)

# fit the lazy object
reg = LazyRegressor(verbose=0, ignore_warnings=False, custom_metric=None)
models, predictions = reg.fit(X_train, X_test, y_train, y_test)

# print the results in a table
print(models)

The code above outputs:

Output 4

The following is a detailed examination of the best regression model:

model_dictionary = reg.provide_models(X_train,X_test,y_train,y_test)
model_dictionary['ExtraTreesRegressor']

Output 5

Here, we can see that a SimpleImputer was used on the entire set of data, followed by a StandardScaler on the numerical features. There are no categorical or ordinal features in this dataset, but if there were, OneHotEncoder and OrdinalEncoder would have been used, respectively. The ExtraTreesRegressor model receives the data after transformation and imputation.

Conclusion

 The LazyPredict library is a useful resource for anybody involved in the machine learning industry. LazyPredict saves time and effort by automating the process of creating and assessing models, which greatly improves the effectiveness of the model selection process. LazyPredict offers a quick and simple method for comparing the effectiveness of several models and determining which model family is best for our data and problem due to its capacity to fit and assess numerous models simultaneously.

The following link has all the programming examples uploaded to the GitHub repository so that you can play around with the codes according to your requirements.

I hope that now you got an intuitive understanding of the LazyPredict library, and these concepts will help you in building some really valuable projects. 



Source link

ShareSendTweet
Previous Post

Marques Brownlee – White Chicks

Next Post

Mask of the Lunar Eclipse’ and Today’s Other New Releases, Plus the Latest Sales – TouchArcade

Related Posts

Adding Mermaid Diagrams to Markdown Documents

June 7, 2023
0
0
Adding Mermaid Diagrams to Markdown Documents
Software Development

Mermaid is a trendy diagramming tool. A year ago, it was integrated into the Markdown rendering of GitHub. It is...

Read more

Idempotent Liquibase Changesets – DZone

June 7, 2023
0
0
Idempotent Liquibase Changesets – DZone
Software Development

Abstract “Idempotence is the property of certain operations in mathematics and computer science whereby they can be applied multiple times...

Read more
Next Post
Mask of the Lunar Eclipse’ and Today’s Other New Releases, Plus the Latest Sales – TouchArcade

Mask of the Lunar Eclipse’ and Today’s Other New Releases, Plus the Latest Sales – TouchArcade

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2021 GetUpdated – MW.

  • About
  • Advertise
  • Privacy & Policy
  • Terms & Conditions
  • Contact

No Result
View All Result
  • Game Updates
  • Mobile Gaming
  • Playstation News
  • Xbox News
  • Switch News
  • MMORPG
  • Game News
  • IGN
  • Retro Gaming
  • Tech News
  • Apple Updates
  • Jailbreak News
  • Mobile News
  • Software Development
  • Photography
  • Contact

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?