Site icon Machine Learning Projects

Easiest way to Detect Data Drift in your dataset using Evidently in Python – 2023

Machine Learning Projects

Hey guys, in today’s blog we will see how to Detect Data Drift in your dataset using evidently module in Python. Checking Data Drift is a very important preprocessing step while preparing your data.

This is going to be a very interesting and informative blog, so without any further due, Let’s do it…

Snapshot of our Final Report…

Step 1 – Importing required Packages

import pandas as pd
from evidently.dashboard import Dashboard
from evidently.dashboard.tabs import DataDriftTab

Step 2 – Reading the Data

df = pd.read_csv('UCI_Credit_Card.csv')
print(df.columns)

Step 3 – Creating a Data Drift report

credit_data_drift_dashboard = Dashboard(tabs=[DataDriftTab(verbose_level=1)])
credit_data_drift_dashboard.calculate(df[:25000], df[25000:], column_mapping=None)
credit_data_drift_dashboard.save('DataDrift.html')
print('Data Drift saved')

Our Final Report

Let’s open the BILL_AMT_4 field

Let’s see the full code…

import pandas as pd
from evidently.dashboard.tabs import DataDriftTab
from evidently.dashboard import Dashboard


df = pd.read_csv('UCI_Credit_Card.csv')
print(df.columns)


credit_data_drift_dashboard = Dashboard(tabs=[DataDriftTab(verbose_level=1)])
credit_data_drift_dashboard.calculate(df[:25000], df[25000:], column_mapping=None)
credit_data_drift_dashboard.save('DataDrift.html')
print('Data Drift saved')

Do let me know if there’s any query when you Detect Data Drift in your dataset.

So this is all for this blog folks. Thanks for reading it and I hope you are taking something with you after reading this and till the next time …

Read my previous post: How to Deploy a Flask app online using Pythonanywhere

Check out my other machine learning projectsdeep learning projectscomputer vision projectsNLP projects, and Flask projects at machinelearningprojects.net.

Exit mobile version