We have seen the introduction of Lazypredict and Regression models to make our life easy to check which models better for our data.
In this blog, we will go through a code of the Lazypredict Classifier problem. I have prepared my own data and posted it onto the GitHub repository to download this data.
In this example, I am going to use Jupyter Notebook. I have prepared my own data and posted it onto the GitHub repository to download this data.
Copy to Clipboard
1
#Install lazypredict
2
pip install lazypredict
Copy to Clipboard
8
1
#Import Lazypredict and all libraries
2
import lazypredict
3
from lazypredict.Supervised import LazyClassifier
4
from sklearn.model_selection import train_test_split
5
import os
6
import pandas as pd
7
pd.set_option('float_format', '{:f}'.format)
8
import numpy as np
Copy to Clipboard
5
1
#Function to download and read delivery data CSV file
2
DATA_FILES_PATH = r"C:\\Users\\gchandr4\\Documents\\Blogs\\LazyPredict Classifier"
3
def load_customer_data(data_path=DATA_FILES_PATH):
4
csv_path = os.path.join(data_path, "delivery_days_classifier.csv")
5
return pd.read_csv(csv_path)
Copy to Clipboard
2
1
#load the data
2
data = load_customer_data()
Copy to Clipboard
2
1
#Print Data
2
data.head()

Copy to Clipboard
3
1
#Split data into X and y target
2
X = data[['Sold To', 'Ship To', 'Material', 'Price/Qty (USD)', 'Qty', 'Total Price (USD)', 'no_of_delivery_days']]
3
y = data[['target_ouput']]
Copy to Clipboard
1
1
X

Copy to Clipboard
1
1
y

Copy to Clipboard
1
1
X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.5,random_state =123)
Copy to Clipboard
2
1
clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)
2
models, predictions = clf.fit(X_train, X_test, y_train, y_test)

Copy to Clipboard
1
1
print(models)
Many classifiers works best for this data.
Further Reading
Posts on Artificial Intelligence, Deep Learning, Machine Learning, and Design Thinking articles:
Rasa X Open Source Conversational AI UI Walk-through
Artificial Intelligence Chatbot Using Neural Network and Natural Language Processing
Leave A Comment