Sitemap

Week 7 as an AI / ML Fellow

Unsupervised Learning, Clustering & Market Basket Analysis

Press enter or click to view image in full size

Week 7 of my AI / ML Fellowship was all about exploring patterns in data without labels. This was my introduction to Unsupervised Learning, where models do not rely on predefined outputs but instead discover hidden structures on their own.

This week completely changed how I see data — instead of predicting outcomes, I learned how to analyze, group, and extract meaningful insights from raw datasets.

Week 7 Sprint Goal (Unsupervised Learning Readiness)

The objective of this week was:

  • Understand Unsupervised Learning concepts
  • Implement K-Means Clustering from scratch
  • Learn Hierarchical Clustering for analysis
  • Apply Dimensionality Reduction (PCA, t-SNE)
  • Explore Association Rule Mining (Apriori)
  • Perform Market Basket Analysis
  • Build a complete data analysis pipeline

Submission required one structured Jupyter Notebook (.ipynb) with markdown + code.

Task 1 — Clustering Fundamentals (K-Means from Scratch)

This task introduced me to how machines group similar data.

K-Means Clustering (From Scratch)

I implemented K-Means manually to fully understand its working:

  • Initialize centroids randomly
  • Assign points to nearest centroid
  • Update centroids (mean of cluster points)
  • Repeat until convergence

Key Learning

  • Distance metrics (Euclidean distance)
  • Cluster optimization
  • Importance of choosing correct K

AI/ML Takeaway

Clustering helps uncover hidden patterns in data without supervision.

Task 2 — Hierarchical Clustering for Data Analysis

Unlike K-Means, this method builds a tree-like structure (dendrogram).

Concepts Covered

  • Agglomerative Clustering (bottom-up approach)
  • Dendrogram visualization
  • Cluster merging based on similarity

Why It Matters

  • No need to predefine number of clusters
  • Better for understanding data relationships

AI/ML Takeaway

Hierarchical clustering provides interpretability, not just grouping.

Task 3 — Dimensionality Reduction (PCA & t-SNE)

High-dimensional data is hard to visualize — this is where dimensionality reduction helps.

PCA (Principal Component Analysis)

  • Reduced features while keeping maximum variance
  • Converted high-dimensional data → lower dimensions

t-SNE Visualization

  • Used for visualizing clusters
  • Preserves local structure in data

Key Difference

  • PCA → Linear reduction
  • t-SNE → Non-linear visualization

AI/ML Takeaway

Dimensionality reduction makes complex data interpretable and visualizable.

Task 4 — Association Rule Mining (Apriori Algorithm)

This task focused on discovering relationships between items.

Apriori Algorithm

  • Finds frequent itemsets
  • Generates association rules

Key Metrics

  • Support → Frequency of item
  • Confidence → Likelihood of rule
  • Lift → Strength of association

Example Insight

If a customer buys bread → likely to buy butter

AI/ML Takeaway

Association rules help businesses understand customer behavior patterns.

Task 5 — End-to-End Assignment (Market Basket Analysis)

Press enter or click to view image in full size

This was the main practical implementation of the week.

Project: Market Basket Analysis

I applied Apriori algorithm on a dataset to analyze customer purchase patterns.

Steps Performed

  • Data preprocessing (transaction format)
  • Applied Apriori algorithm
  • Generated frequent itemsets
  • Extracted association rules
  • Interpreted business insights

Tools Used

  • Python
  • Pandas
  • MLxtend (Apriori implementation)

Outcome

  • Identified commonly bought item combinations
  • Derived actionable insights for retail

AI/ML Takeaway

Data can directly drive business decisions when analyzed correctly.

GitHub Repository Structure

To maintain clarity and follow submission rules:

Week7_Unsupervised_Learning/
├── Week7_Assignment.ipynb
├── README.md
└── requirements.txt
  • Single notebook (as required)
  • Proper markdown explanations
  • Clean, readable code

Weekly Reflection — Learnings, Challenges & Growth

Learnings from Week 7

  • Deep understanding of unsupervised learning
  • Clustering techniques (K-Means & Hierarchical)
  • Dimensionality reduction (PCA & t-SNE)
  • Association rule mining (Apriori)
  • Real-world data analysis skills

Challenges I Faced

  • Choosing optimal number of clusters
  • Understanding PCA mathematically
  • Interpreting association rules correctly
  • Working with unstructured data

Key Insights

  • Not all problems require labeled data
  • Visualization is powerful in ML
  • Business insights come from patterns, not just predictions
  • Clean preprocessing is critical

How This Week Connects to AI/ML Fellowship

This week laid the foundation for:

  • Customer analytics
  • Recommendation systems
  • Data visualization
  • Real-world business intelligence

Final Reflection — Week 7 Impact

Week 7 taught me an important concept:

Get Maryam Fatima’s stories in your inbox

Join Medium for free to get updates from this writer.

Data speaks — even when labels are missing.

I learned how to:

  • Discover hidden patterns
  • Analyze relationships
  • Transform raw data into meaningful insights

This week shifted my mindset from:
➡ Predicting outcomes
➡ To understanding data behavior