Data Quality › Practical Guidelines
Machine Learning from ScratchAll chapters Data Quality › Practical GuidelinesOne section · Sections in this chapter6 / 9 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Implementing data quality practices requires systematic workflows that integrate quality checks throughout the analysis pipeline rather than treating them as afterthoughts. Begin every project by profiling the data to understand how it is structured and distributed and where quality issues may occur before conducting the main analyses. Document all quality decisions transparently so that others can understand and evaluate the choices made.
Data Profiling Workflow
Start by generating summary statistics for all variables, including counts of missing values, observed ranges, and measures of center and spread. These summaries often reveal obvious data quality problems immediately: negative ages, impossible dates, or values outside expected ranges indicate errors requiring investigation. Calculate missing data percentages for each variable and examine patterns of missingness across variables to understand whether missingness is isolated or systematic.
Create visualizations for each variable appropriate to its type. Histograms for continuous variables reveal distributional shape and potential outliers. Bar charts for categorical variables show frequency distributions and identify rare categories that might be data quality issues or legitimate rare values. Box plots highlight outliers efficiently. Time series plots reveal temporal patterns in data collection that might indicate systematic quality degradation.
Cross-tabulate related variables to identify impossible combinations. A dataset containing both birth year and age should show consistency between them. Discrepancies indicate errors in at least one variable. Geographic variables should form valid combinations (city-state-country), and categorical hierarchies should be logically consistent. These relationship checks catch errors that univariate summaries miss.
Documentation Standards
Maintain detailed documentation of all data quality decisions throughout the analysis. Create a data quality log recording every issue identified, the investigation conducted, and the resolution implemented. For each excluded observation, document the reason for exclusion and the criteria applied. This transparency enables others to understand and evaluate your decisions, and helps you maintain consistency when similar issues arise later.
Report missing data percentages for all key variables in analysis reports. Explicitly state which missingness mechanism is assumed and which handling method was applied. If multiple imputation was used, report the number of imputations and the imputation model specification. For complete case analysis, report how many observations were excluded and whether excluded cases differ systematically from retained cases on observable characteristics.
When outliers are removed or treated specially, document the identification criteria and the number of affected observations. Report results both with and without outliers when feasible to show their influence on conclusions. If transformations are applied to address outliers or skewness, clearly state this and interpret results on the transformed scale appropriately.
Quality Assurance Practices
Implement automated checks that run each time data is updated or refreshed. These checks should verify that values fall within expected ranges, that required variables are present, that unique identifiers are indeed unique, and that relationships between variables remain consistent. Automated checks catch new errors introduced in data updates before they propagate into analyses.
For important analyses, conduct sensitivity analyses examining how conclusions change under different quality-related decisions. Compare results from complete case analysis, multiple imputation, and maximum likelihood estimation for missing data. Examine whether outlier treatment affects the main conclusions. If results remain consistent across reasonable alternatives, confidence in the findings increases. If results change dramatically, acknowledge this uncertainty and investigate which assumptions drive the differences.
Validate data against external sources when possible. Cross-reference aggregated statistics from your data against published values from administrative records or prior studies. Large discrepancies suggest potential data quality problems worth investigating. Conduct logical checks based on domain knowledge: are rates of rare diseases consistent with epidemiological literature? Are sales patterns consistent with known seasonality?