Data Cleaning Tutorials by Ankita Sharma
Before any model can learn from data, that data has to be cleaned. This video breaks down the core steps of data cleaning using a loan dataset as a working example.
Every machine learning model is only as good as the data it learns from, and raw data is almost never ready to use. Numbers are missing, categories are spelled inconsistently, and a handful of extreme values can throw off an entire model. Before any algorithm gets applied, that data has to be cleaned, and this video walks through exactly what that process looks like using a real loan dataset as a working example.
Numerical versus categorical data
The starting point for any cleaning process is understanding what kind of values you're working with. Numerical values are those expressed as numbers, like weight or height, where arithmetic operations make sense. Categorical values represent groups or categories instead, like loan status or employment type. This distinction matters because the techniques used to clean and transform a column depend entirely on which type it is.
Handling missing values
Missing data is one of the first problems a dataset throws at you. There are a few standard ways to deal with it. You can replace a missing value with a statistical measure such as the mean, median, or mode of that column. You can remove rows or columns with missing values, which works fine if the amount of missing data is small and insignificant, but risks losing useful information if it's not. A more advanced option is using machine learning algorithms to predict what the missing values likely were, based on the other features in the dataset.
Detecting and handling outliers
Outliers are extreme values that can distort a model's understanding of the data. They can be detected in numerical columns using statistical methods like the Z-score, or visually through techniques like box plots. Once identified, outliers can sometimes be removed if they're the result of errors or genuine anomalies. In other cases, rather than deleting them, it's better to transform the data using methods like scaling or log transformation, which reduces the outsized impact those extreme values have on the model.
Data transformation and scaling
Once missing values and outliers are addressed, the data usually needs to be transformed and scaled so that features are comparable to one another. Standardization means adjusting numerical values so they have a mean of zero and a standard deviation of one. Normalization scales numerical features into a fixed range, typically between 0 and 1. Log transformation applies a logarithmic function to smooth out inconsistent data distributions. For categorical variables, encoding techniques such as one-hot encoding and label encoding convert category labels into numerical values that a model can actually use.
Handling inconsistent data
Categorical columns often contain inconsistencies: misspellings, variations in capitalization, or different ways of writing the same category. Cleaning this up starts with identifying where those inconsistencies exist, then standardizing the data by correcting errors, converting entries to a consistent format, or grouping similar categories together. The goal is to make sure the same real-world category is always represented the same way across every record in the dataset.
Key takeaways
- Data cleaning directly affects the performance and accuracy of any model trained on that data.
- Missing values can be handled by imputing a statistical measure, dropping insignificant rows or columns, or predicting them with a model.
- Outliers should be detected with methods like Z-score or box plots, then either removed or reduced in impact through scaling or log transformation.
- Standardization, normalization, and log transformation prepare numerical features for modeling, while one-hot and label encoding handle categorical features.
- Inconsistent categorical data needs to be standardized so the same category is represented the same way throughout the dataset.
Who this is for
This video is for anyone starting out in data analysis or machine learning who needs a clear, practical grounding in what data cleaning actually involves before moving on to modeling. It's a solid foundation for learners exploring the data science content from Humanitarians AI, especially those about to work with real, messy datasets for the first time.
Full transcript(auto-generated, with timestamps)
[0:00]In this video we will learn about what is data cleaning in machine learning so let's start so basically data cleaning is the process of detecting and correcting errors inconsistencies and inaccuracies in a data set basically to improve their quality and reliability data cleaning also plays an important role in a machine learning projects as indirectly impacts the performance and accuracy of the model train on a data in this particular video I'm using this loan data set so there are two type of values in this particular data set like the numerical values and your categorial values so first we need to understand what is numerical values and what are
[0:50]The categorial values so numerical values are those values which consist of values that are expressed in the term of numbers for example your weight height right these all consider in a numerical data and the categorial consist of the values that represent inner categories and groups now what are the steps to clean the data in your data set so there are various number of steps that involved in data cleaning so very first is handling the missing values so if you identify a missing values in your data set so how you can handle so for that you replace a missing value with a statistical measure such as
[1:40]Mean medium mode and remove the rows and columns with the missing values if they are insignificant also you can use the machine learning algorithms to predict missing values based on other features now second one is handling outlier so detect outl in a numerical data using statistical method like Z score or visualization technique such as box plots so you can easily handle your outlier with these methods also you can remove a outlier if they are due to errors or anomalies so for that you transform the data using method like scaling log transformation and to mitigate the impact of outliers now the next one is your data
[2:43]Transformation and scaling so uh very first thing is what is standardization so it means you have to feature your numerical values with the mean of zero and a standard deviation of one now coming up to what is normalization so scale numerical features to arrange typically between 0 and one that is consider in normalization and the next one is your log transformation means that apply some logarithmic transformation to handle the inconsistent data distributions also you can also use uncoding in a data transformation and scaling that means you need to convert your categorial V value variables or value into a numerical values uh with the help of some
[3:52]Techniques that is your one hot encoding and the label encoding that we will look into in our practical which we will do later and the next one is very important handling inconsistent data so as I mentioned before that first you need to understand what are the type of misspelling or variation in your categorial value so identify those consistencies in inconsistencies first then standardize inconsistent data by correcting errors converting to a consistent format or grouping similar categories also you can ensure a consistency in the data representation across all records so these all steps are involved to clean up the data in your ml or now in the next video we will look
[4:58]Into some practical work thank you
More videos
2:08Bridging the Pixel Gap in Browser Automation.
2:23How One Narrow Safety Rule Can Make an AI Less Safe Everywhere Else.
2:04Why splitting a chunk from its document makes it retrieve for the wrong question
4:20Three You Can Take Back. One You Can't.
2:21Why a 50-turn agent pays for the same screenshot 35 times unless it caches the pixels
1:53