Applications of Data Analytics — Bringing It All Together
This final lesson revisits applications with everything you have learned across the four units, tracing complete end-to-end pipelines and showing exactly which technique from which unit does which job.
Case Study 1 — E-Commerce Recommendation and Retention
Business problem: increase repeat purchases and average order value.
| Stage | Technique | Unit |
|---|
| Collect clickstream, orders, reviews | Data collection from logs, APIs, databases | 1 |
| Clean missing prices, remove bot sessions | Data cleaning, outlier detection | 1 |
| Standardise features for distance-based models | Normalization, encoding | 1 |
| Understand purchase distribution, seasonality | EDA — histograms, box plots, time series | 2 |
| Test whether a new layout raised conversion | A/B test, two-sample hypothesis test | 2 |
| "Frequently bought together" bundles | Apriori / association rules | 3 |
| Segment customers into behavioural groups | K-Means clustering on RFM features | 3 |
| Predict which customers will churn | Classification (Naïve Bayes / logistic regression) | 3 |
| Forecast next month's revenue | Linear regression / time series | 3 |
| Run all of it over billions of events | Spark on HDFS | 4 |
| Executive dashboard | Matplotlib / Seaborn / BI tool | 4 |
# A compact version of the segmentation + rules pipeline
import pandas as pd, numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
np.random.seed(42)
customers = pd.DataFrame({
"customer_id": [f"C{i:04d}" for i in range(300)],
"recency_days": np.random.randint(1, 200, 300),
"frequency": np.random.poisson(4, 300) + 1,
"monetary": np.random.gamma(3, 4000, 300).round(0),
})
X = StandardScaler().fit_transform(customers[["recency_days","frequency","monetary"]])
customers["segment"] = KMeans(n_clusters=4, n_init=10, random_state=42).fit_predict(X)
profile = customers.groupby("segment")[["recency_days","frequency","monetary"]].mean().round(1)
profile["size"] = customers["segment"].value_counts().sort_index()
profile["strategy"] = [
"Re-engagement campaign", "VIP loyalty programme",
"Upsell higher-value items", "Win-back discount",
]
print(profile)
Case Study 2 — Healthcare: Early Disease Risk Prediction
| Stage | Technique | Unit |
|---|
| Gather EHR, lab results, vitals | Primary + secondary data collection | 1 |
| Handle missing lab values | MAR-aware imputation, KNN imputation | 1 |
| Balance a rare-disease dataset | Stratified sampling, SMOTE | 1, 3 |
| Compare risk-factor distributions across groups | Descriptive statistics, box plots | 2 |
| Test whether a biomarker differs in patients vs controls | Two-sample t-test, effect size | 2 |
| Predict disease presence | Naïve Bayes / KNN / logistic regression | 3 |
| Evaluate with the right metric | Recall prioritised — a false negative is catastrophic | 3 |
| Group patients by symptom profile | Hierarchical clustering | 3 |
| Scale to a national health registry | Hadoop / Spark | 4 |
The single most important design decision here is the metric. As shown in the classification lesson, a 97%-accurate model that misses 40% of real cases is unacceptable in medicine. Optimise for recall, and use Bayes' theorem (Unit 2) to explain to clinicians why a positive screening result still needs a confirmatory test.
Case Study 3 — Banking: Real-Time Fraud Detection
| Requirement | How the course maps to it |
|---|
| Sub-100 ms decision | Naïve Bayes / tree ensembles — fast inference (Unit 3) |
| Extreme class imbalance (0.1% fraud) | Stratified sampling, class weights, F1/PR-AUC (Units 1, 3) |
| Outliers ARE the signal | Never delete outliers — they are the target (Unit 1) |
| Behavioural baseline per customer | Clustering + z-scores against personal history (Units 2, 3) |
| Billions of transactions | Stream processing on Kafka + Spark (Unit 4) |
| Explain a decline to a regulator | Interpretable models, coefficient reporting (Unit 3) |
Case Study 4 — Education: Predicting At-Risk Students
import pandas as pd, numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import make_pipeline
from sklearn.metrics import classification_report, confusion_matrix
np.random.seed(42)
n = 600
students = pd.DataFrame({
"attendance_pct": np.random.beta(6, 2, n) * 100,
"assignments_done": np.random.binomial(10, 0.75, n),
"internal_marks": np.random.normal(60, 15, n).clip(0, 100),
"lms_logins_week": np.random.poisson(6, n),
})
# True underlying risk
risk = (-0.06*students["attendance_pct"] - 0.30*students["assignments_done"]
- 0.05*students["internal_marks"] - 0.12*students["lms_logins_week"] + 11)
students["will_fail"] = (risk + np.random.normal(0, 0.8, n) > 0).astype(int)
X = students.drop(columns="will_fail")
y = students["will_fail"]
X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.25,
random_state=42, stratify=y)
model = make_pipeline(StandardScaler(),
LogisticRegression(class_weight="balanced", max_iter=2000))
model.fit(X_tr, y_tr)
pred = model.predict(X_te)
print(confusion_matrix(y_te, pred))
print(classification_report(y_te, pred, target_names=["Pass", "At Risk"]))
coefs = pd.DataFrame({
"feature": X.columns,
"coefficient": model.named_steps["logisticregression"].coef_[0].round(3),
}).sort_values("coefficient")
print("\nRisk drivers (most protective first):\n", coefs)
# Intervention: flag high-risk students by week 8 for mentoring —
# recall matters more than precision, since a false alarm just means
# an extra counselling session.
Domain Summary Table
| Domain | Primary techniques | Typical outcome |
|---|
| Retail / E-commerce | Association rules, clustering, forecasting | Recommendations, bundles, inventory planning |
| Banking / Finance | Classification, anomaly detection, time series | Fraud blocked, credit risk scored |
| Healthcare | Classification, clustering, hypothesis testing | Earlier diagnosis, better resource planning |
| Manufacturing | Regression, control charts, anomaly detection | Predictive maintenance, fewer defects |
| Marketing | Segmentation, A/B testing, CLV regression | Higher ROI per campaign rupee |
| Education | Classification, EDA, item analysis | Earlier intervention, better outcomes |
| Transport | Optimisation, regression, geospatial | Faster routes, accurate ETAs |
| Government | Descriptive analytics, forecasting, geospatial | Better-targeted policy and services |
| Agriculture | Regression, image classification, forecasting | Higher yields, lower input cost |
| Entertainment | Recommendation, clustering, engagement modelling | Longer retention, better content investment |
The Analyst's Toolkit — Complete Map
| Question you face | Technique | Unit | Python tool |
|---|
| What is a typical value? | Mean, median, mode | 2 | df.describe() |
| How spread out is it? | Variance, SD, IQR, CV | 2 | df.std(), df.quantile() |
| Do two variables move together? | Correlation | 2 | df.corr() |
| What does the distribution look like? | Histogram, KDE, box plot | 2 | sns.histplot, sns.boxplot |
| Is this difference real or chance? | Hypothesis test | 2 | scipy.stats |
| What will the value be? | Regression | 3 | LinearRegression |
| Which category does it belong to? | Classification | 3 | GaussianNB, KNeighborsClassifier |
| What natural groups exist? | Clustering | 3 | KMeans, AgglomerativeClustering |
| What items go together? | Association rules | 3 | mlxtend.apriori |
| How do I clean this mess? | Imputation, outlier treatment | 1 | fillna, IQR fences |
| How do I make features comparable? | Normalization, encoding | 1 | StandardScaler, get_dummies |
| It doesn't fit in memory | Distributed processing | 4 | Spark, HDFS, chunked Pandas |
Ethics and Responsible Analytics
| Principle | What it demands of you |
|---|
| Privacy | Minimise, anonymise, and secure personal data; comply with DPDP/GDPR |
| Fairness | Test model performance separately for each demographic group; biased training data produces biased models |
| Transparency | Be able to explain why a model made a decision that affects someone |
| Accountability | A human owns every automated decision |
| Honesty in visualization | Zero baselines, full context, no cherry-picked ranges |
| Correlation ≠ causation | Never present an association as a cause without an experiment |
| Statistical integrity | No p-hacking; report effect sizes; state assumptions and limitations |
| Data minimisation | Collect only what the stated purpose requires |
Career Paths
| Role | Focus | Core skills from this course |
|---|
| Data Analyst | Descriptive + diagnostic; reporting | SQL, Excel, Pandas, visualization, statistics |
| Business Analyst | Translating business questions to analysis | Domain knowledge, EDA, dashboards, communication |
| Data Scientist | Predictive + prescriptive modelling | ML (Unit 3), statistics (Unit 2), Python |
| Data Engineer | Pipelines and infrastructure | SQL, Spark, Hadoop, ETL, cloud (Unit 4) |
| ML Engineer | Productionising models | ML + software engineering + deployment |
| BI Developer | Dashboards and semantic layers | Power BI/Tableau, SQL, data modelling |
Course Wrap-Up — How It All Connects
Every concept in this course is one link in that loop. The statistics of Unit 2 are what let you tell a real pattern from noise in Unit 3. The cleaning discipline of Unit 1 is what makes any of Unit 3's models trustworthy. And the tools of Unit 4 are what let you do all of it on data that a spreadsheet could never open.
The most valuable habit you can carry out of this course: always plot the data before you model it, always report the effect size alongside the p-value, and never let a model's confidence exceed the quality of the data it was trained on.