Data is rarely perfect when we receive it. Real-world datasets often contain missing values, outliers, inconsistent formats, duplicate records, and irrelevant features. Before applying machine-learning algorithms, it is therefore important to understand and prepare the data properly.
Data Cleaning and Exploration with Machine Learning by Michael Walker, published by Packt in 2022, focuses on this important stage of the machine-learning workflow. The book is 542 pages and is aimed particularly at early-career data scientists and analysts who are new to machine learning. It combines data cleaning and exploration with supervised and unsupervised learning techniques.
Download the PDF free:
Data Cleaning and Exploration with Machine Learning: Get to grips with machine learning techniques to achieve sparkling-clean data quickly(Free PDF)
Why Data Cleaning Matters
A machine-learning model learns from the data it receives.
If the data contains errors, the model can learn incorrect patterns.
The basic workflow is:
Raw Data → Cleaning → Exploration → Preprocessing → Machine Learning → Evaluation
Good data preparation can therefore have a major impact on model performance.
Understanding Data Distribution
Before building a model, it is important to understand how variables are distributed.
The book covers techniques for examining:
- Categorical features
- Continuous variables
- Discrete variables
- Histograms
- Box plots
- Violin plots
- Summary statistics
These techniques help identify unusual patterns and potential problems in the dataset.
Handling Outliers
Outliers are observations that are unusually different from the rest of the data.
For example:
10, 12, 11, 13, 12, 150
Here, 150 may require investigation.
Outliers can sometimes represent genuine observations, while in other cases they may indicate errors. Therefore, they should be investigated rather than automatically deleted.
Data Preprocessing
Preprocessing transforms raw data into a form suitable for machine learning.
It can include:
- Handling missing values
- Encoding categorical variables
- Scaling numerical features
- Removing unnecessary variables
- Feature selection
- Preparing training and testing datasets
The book emphasizes matching preprocessing techniques with the requirements and assumptions of different algorithms.
Feature Selection
Not every feature contributes useful information.
Feature selection helps identify variables that are valuable for prediction while reducing unnecessary complexity.
It can involve examining:
- Feature importance
- Correlation
- Statistical relationships
- Model performance
This can make models easier to interpret and potentially improve their performance.
Anomaly Detection
Machine learning can also help identify unusual observations.
Anomaly detection can be useful for finding:
- Unusual transactions
- Data errors
- Fraud-like behavior
- Abnormal measurements
This is an interesting example of machine learning being used during data preparation, rather than only for final prediction.
Exploratory Data Analysis
Exploratory Data Analysis, or EDA, helps analysts understand relationships within a dataset.
Typical questions include:
- Which variables are related?
- What patterns exist?
- Are there unusual observations?
- Which features may be useful?
- Does the data meet model assumptions?
EDA connects data cleaning with machine-learning model selection.
Supervised Learning
The book introduces supervised-learning techniques for both continuous and categorical targets.
Regression
Used when the target is numerical.
Examples:
- Price prediction
- Sales forecasting
- Demand estimation
Classification
Used when the target represents categories.
Examples:
- Fraud / Not Fraud
- Churn / No Churn
- Positive / Negative
Unsupervised Learning
The book also covers unsupervised learning, particularly dimensionality reduction and clustering.
PCA
Principal Component Analysis reduces the dimensionality of data while attempting to preserve important information.
K-Means
K-Means groups similar observations into clusters.
DBSCAN
DBSCAN identifies clusters based on density and can also help identify unusual observations.
Model Evaluation
Building a model is only the beginning.
The model must be evaluated to determine whether it works well on unseen data.
Important concepts include:
- Training and testing
- Validation
- Model performance
- Prediction accuracy
- Comparing algorithms
The book specifically focuses on preparing data for testing and validation and interpreting machine-learning results.
Python and Machine Learning
The book is designed around programmatic data manipulation and machine-learning workflows. It is particularly suitable for readers with beginner-level experience manipulating data programmatically and basic undergraduate statistics knowledge.
The concepts can be implemented using the Python Data Science ecosystem, including tools such as:
- Pandas
- NumPy
- Matplotlib
- Scikit-learn
Who Should Read This Book?
This book is especially useful for:
- Aspiring Data Scientists
- Early-career Data Scientists
- Data Analysts moving into ML
- Machine Learning beginners
- Python learners
- Students working on ML projects
It is less suitable for someone looking for a purely beginner-level Python introduction because some prior programming and statistics knowledge is expected.
Key Takeaways
The book highlights an important principle:
Machine Learning starts before model training.
A strong workflow is:
Understand Data
↓
Clean Data
↓
Explore Data
↓
Select Features
↓
Choose Algorithm
↓
Train Model
↓
Evaluate Results
The book covers this progression across 22 chapters, including data distributions, preprocessing, supervised learning, Naรฏve Bayes, PCA, K-Means, and DBSCAN.
Hard Copy: Data Cleaning and Exploration with Machine Learning: Get to grips with machine learning techniques to achieve sparkling-clean data quickly
Kindle:Data Cleaning and Exploration with Machine Learning: Get to grips with machine learning techniques to achieve sparkling-clean data quickly
Download the PDF free:
Data Cleaning and Exploration with Machine Learning: Get to grips with machine learning techniques to achieve sparkling-clean data quickly(Free PDF)
Final Verdict
Data Cleaning and Exploration with Machine Learning is a useful resource for understanding one of the most important—and often overlooked—parts of Data Science: preparing data before modeling.
Its biggest strength is that it does not treat data cleaning as a separate task from machine learning. Instead, it explains how understanding the distribution, relationships, anomalies, and characteristics of data should influence preprocessing and algorithm selection.
