Data and modeling
Machine learning for data analysis
Machine learning extends data analysis from describing what happened to predicting and grouping. Analysts use regression to estimate a measured outcome, clustering to segment customers or records, and feature importance to see which variables a model relies on.
How machine learning is used in data analysis
Segmenting customers
Clustering groups customers by behaviour, such as how recently, how often and how much they buy, so each group can be served differently. Analysts usually build a few summary features per customer, scale them and try k-means before anything more complex.
Real exampleRFM customer segmentation of a UK online retailer (Chen, Sain and Guo, 2012)The paper segments the customers of a UK online retailer using RFM (recency, frequency, monetary) features and data mining, and is the introductory paper for the UCI Online Retail dataset.
Spotting unusual changes in metrics
Instead of eyeballing dashboards, anomaly detection models learn the normal range of a metric, including its weekly pattern, and flag days that fall outside it. This lets analysts look into real changes rather than ordinary noise.
Real exampleGoogle Analytics anomaly detectionGoogle Analytics lets users create insights with a 'has anomaly' condition, in which Analytics determines when a change in a metric is anomalous without a fixed threshold.
Grouping free-text feedback
Survey comments, reviews and support tickets are too many to read one by one. Topic models and embedding-based clustering group them into themes an analyst can count, label and track over time.
Real exampleBERTopic (Grootendorst, 2022)BERTopic clusters document embeddings and describes each cluster with a class-based TF-IDF procedure to produce interpretable topics.
Estimating what drives an outcome
Regression and tree models estimate how much each variable is associated with an outcome such as sales or grades, beyond what a simple cross-tab shows. Analysts then check the result against domain knowledge before treating it as a driver.
Real exampleRobyn (Meta, open source)Robyn estimates the contribution of each marketing channel to an outcome with ridge regression, using automated hyperparameter search to reduce analyst bias.
Can you learn machine learning for data analysis?
Yes, and analysts are well placed to learn it because the hardest parts, cleaning data and asking good questions, are already familiar. Move from spreadsheets or SQL to Python and pandas, then add statistics and a small set of models with proper evaluation.
- PythonLearn enough Python to replace repeated spreadsheet steps with scripts you can rerun on new data.Learn it in Python
- pandas and visualisationFilter, group, join and reshape tables in pandas, and chart distributions and relationships before modelling.Learn it in Data Tools
- Statistics for analystsRevisit descriptive statistics, sampling error and hypothesis tests so model results are read with the right amount of caution.Learn it in Statistics
- Regression, trees and clusteringFit regression and tree models with a held-out test set, explain them with feature importance, and cluster records when there is no label.Learn it in Machine Learning
Moving from data analysis into machine learning
If you already work in the field
Data analysts already know SQL, the business metrics and how to present results. Add Python and scikit-learn, then pick one recurring question, such as which customers are likely to churn, and answer it with a model that beats a simple baseline on held-out data.
If you come from data science or ML
If you know modelling but not analysis work, practise the analyst's habits: checking data quality, reconciling numbers with finance or operations, and turning results into a short chart-led summary. Spend time with the people who own the metrics you model.
Roles that do this workData analystSenior data analystAnalytics engineerBusiness intelligence analystData scientist
Tools you will use
| Tool | What you use it for |
|---|---|
| pandas | Filter, group and summarise records to answer descriptive questions before modelling. |
| Polars | Process larger tables quickly with a lazy, multi-threaded DataFrame engine. |
| Matplotlib | Draw the charts that check distributions, trends and model residuals. |
| scikit-learn | Run regression, k-means clustering and permutation importance with one consistent interface. |
| SHAP | Break individual predictions into feature contributions to explain a fitted model. |
Public data to practise on
- Student Performance (UCI): Grades, demographics and study habits of secondary-school students in maths and Portuguese, for regression practice.
- Online Retail II (UCI): Transactions from an online retailer, for customer segmentation by recency, frequency and spend.
Your first project
Download the Student Performance dataset, predict final maths grades from background and study-habit columns (leaving out earlier term grades) with a random forest, and compare it with a mean-grade baseline using mean absolute error.
Common questions
Do data analysts use machine learning?
Increasingly, yes, mostly for forecasting, segmentation, anomaly detection and driver analysis. Much day-to-day analysis still relies on SQL, descriptive statistics and well-designed charts.
What is the difference between data analysis and machine learning?
Data analysis explains what happened and why, usually for a person to read. Machine learning builds a model that makes predictions on new data, which is judged by how well it performs on data it has not seen.
Can I do machine learning in Excel?
Excel can fit linear regression and simple forecasts, but it becomes awkward for proper train and test splits, many models and repeatable pipelines. Python with pandas and scikit-learn is the usual next step.
Which machine learning methods should an analyst learn first?
Linear and logistic regression, decision trees and random forests, k-means clustering and a time series baseline cover most analyst problems. Learn cross-validation and simple baselines alongside them.
Courses for these skills
- Practical Machine Learning in PythonConnect inspection to model evaluation and leakage.51 published lessons · more lessons in production
- Data Tools: NumPy, pandas, Matplotlib and scikit-learnInspect feature scales and representative rows.23 published lessons · all planned lessons open
- Statistics and Probability for Machine LearningAssess variation between samples instead of treating a ranking as fixed.41 published lessons · all planned lessons open
New to programming or maths? Start with Python, or follow the machine learning path in order. Published lessons are free to read; compare Free and Pro.