First time studying this topic?

Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.

Topic 1.3

AI Around Us: Real-World Systems

Explore the ubiquitous presence of AI in daily life, from search algorithms and streaming recommendations to facial recognition and smart assistants.

Learning Objectives

  • βœ“Catalog everyday consumer and enterprise systems powered by AI
  • βœ“Examine how recommender engines utilize collaborative and content-based filtering
  • βœ“Understand speech-to-text and NLP in virtual assistants (Siri, Alexa)
  • βœ“Analyze ethical considerations regarding algorithmic bias and surveillance

πŸ“–Let's Begin with a Story

When Spotify recommends an obscure 1970s indie track that you immediately fall in love with, it feels like uncanny psychic intuition. But behind that serendipitous discovery isn't magicβ€”it is high-dimensional matrix factorization and convolutional audio analysis. Spotify models over 600 million users and 100 million tracks as geometric vectors in a shared latent space. Every time you like a song, skip after 10 seconds, or replay a chorus, you transmit micro-signals into a real-time feature pipeline. AI isn't an abstract laboratory concept; it is the invisible operating system orchestrating the modern digital economy.

Why Should You Learn AI Around Us: Real-World Systems?

🎯 Practical & Engineering Stakes

Why study real-world AI deployments?

1. Demystify familiar services: Appreciate the engineering feats inside Netflix, Google Maps, Instagram, and Uber. 2. Identify business opportunities: Discover how traditional brick-and-mortar operations gain massive efficiency via AI automation. 3. Consumer empowerment: Understand how algorithmic feeds curate what you see, read, and believe.

What Is It?

Simple Explanation

AI is already deeply integrated into modern life. When you speak to your phone, it turns sound waves into text using neural networks. When you search on Google, AI ranks billions of pages in milliseconds based on relevance. When you buy something online, AI checks for credit card fraud in under 100 milliseconds.

Technical Explanation

Modern real-world AI applications represent distributed end-to-end pipelines incorporating real-time feature stores, low-latency model inference endpoints, vectorized embedding databases, and feedback loops. Systems combine collaborative filtering, transformer-based NLP, and computer vision with sub-second SLA constraints.

πŸ“š Key Terms

Recommender System

Simple: An algorithm that predicts what items (movies, songs, products) a user will enjoy.
Technical: An information filtering system utilizing matrix factorization, deep embeddings, and graph neural networks to estimate user affinity scores for candidate items.

Collaborative Filtering

Simple: Recommending items by finding users who have similar tastes to you.
Technical: A recommendation methodology predicting unknown ratings by identifying statistical correlations across historical user-item interaction matrices.

Computer Vision

Simple: Teaching computers to identify objects, people, and actions in images and video.
Technical: An AI discipline using convolutional and attention-based architectures to extract high-level semantic representations from spatial pixel arrays.

πŸ“ Mathematical Foundation

LaTeX KaTeX
r^ui=ΞΌ+bu+bi+puTqi\hat{r}_{ui} = \mu + b_u + b_i + \mathbf{p}_u^T \mathbf{q}_i

What does it mean?

Baseline collaborative filtering with matrix factorization: predicts user u rating for item i using latent taste vectors.

Understanding the Symbols

Symbol / TermMeaningBeginner Interpretation
r^ui\hat{r}_{ui}Predicted ratingEstimated score user u will assign to item i
ΞΌ\muGlobal mean ratingAverage rating across all items and users
bu,bib_u, b_iUser & item biasesBaseline tendencies (e.g. strict rater vs popular movie)
pu,qi\mathbf{p}_u, \mathbf{q}_iLatent vectorsMathematical embeddings capturing user preferences and item traits

πŸ“Š Numerical Example

Predicting user rating for a movie when global mean is 3.5, user bias is +0.2, movie bias is +0.4, and dot product is 0.6.

\hat{r}_{ui} = 3.5 + 0.2 + 0.4 + 0.6 = 4.7

Result: Predicted rating is 4.7 / 5.0 (Strongly Recommended)

βš™οΈ How Does It Work?

1

Event Telemetry

User clicks, pauses, and queries are streamed via message brokers like Apache Kafka.

2

Candidate Generation

A lightweight algorithm selects the top 500 candidate items out of millions.

3

Deep Ranking

A neural model scores and ranks the top candidates using hundreds of contextual features.

4

Personalized Delivery

The personalized UI renders items with the highest predicted engagement.

🌍 Where Is It Used?

Dynamic Route Optimization (Google Maps / Uber)

Problem: Predicting vehicle arrival time amid fluctuating traffic jams and accidents.

Solution: Graph Neural Networks model road networks as nodes and edges to re-route drivers proactively.

E-commerce Fraud Detection

Problem: Millions of credit card transactions processed per second require immediate fraud detection.

Solution: Gradient boosted decision trees flag anomaly signatures and block stolen cards in under 30 milliseconds.

🎯 Try It Yourself

If Alice and Bob both gave 5 stars to five identical sci-fi movies, and Alice gives 5 stars to a sixth movie, why will Bob receive that recommendation?

Interactive activity component

🐍 Python Hands-On: Building a Simple Cosine Similarity Recommender

Calculate cosine similarity between user preference vectors to recommend items.

Open Colab

1Install Required Packages

For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:

Terminal / Notebook Install Commandbash
!pip install numpy
Packages:
numpy

2Import Libraries

Import Statementspython
1import numpy as np

import numpy as np β†’ Import NumPy for high-performance vector math

3Demonstration Code & Logic

Python Execution Codepython
1# User ratings on 4 movie genres: [Action, SciFi, Comedy, Drama]
2alice = np.array([5.0, 5.0, 1.0, 1.0])
3bob = np.array([4.0, 5.0, 2.0, 1.0])
4charlie = np.array([1.0, 0.0, 5.0, 4.0])
5
6def cosine_sim(a, b):
7 return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
8
9sim_alice_bob = cosine_sim(alice, bob)
10sim_alice_charlie = cosine_sim(alice, charlie)
11print(f"Alice & Bob Similarity: {sim_alice_bob:.3f}")
12print(f"Alice & Charlie Similarity: {sim_alice_charlie:.3f}")
Step-by-Step Code Breakdown:

# User ratings on 4 movie genres: [Action, SciFi, Comedy, Drama]

Vector definitions

alice = np.array([5.0, 5.0, 1.0, 1.0])

Alice loves Action & SciFi

bob = np.array([4.0, 5.0, 2.0, 1.0])

Bob also loves Action & SciFi

charlie = np.array([1.0, 0.0, 5.0, 4.0])

Charlie loves Comedy & Drama

def cosine_sim(a, b):

Define cosine similarity formula

return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))

Dot product divided by magnitudes

sim_alice_bob = cosine_sim(alice, bob)

Compute Alice-Bob similarity

sim_alice_charlie = cosine_sim(alice, charlie)

Compute Alice-Charlie similarity

print(f"Alice & Bob Similarity: {sim_alice_bob:.3f}")

Print result 1

print(f"Alice & Charlie Similarity: {sim_alice_charlie:.3f}")

Print result 2

πŸ“‹ Complete Script (All-in-One)

Click "Copy for Colab", open Google Colab, paste into a single cell, and run.

Google Colab Notebook Scriptpython
1# =========================================================
2# Building a Simple Cosine Similarity Recommender
3# Prepared for Google Colab (Run with Shift + Enter)
4# =========================================================
5
6# Step 1: Install required packages
7!pip install numpy
8
9# Step 2: Import libraries
10import numpy as np
11
12# Step 3: Run Demonstration
13# User ratings on 4 movie genres: [Action, SciFi, Comedy, Drama]
14alice = np.array([5.0, 5.0, 1.0, 1.0])
15bob = np.array([4.0, 5.0, 2.0, 1.0])
16charlie = np.array([1.0, 0.0, 5.0, 4.0])
17
18def cosine_sim(a, b):
19 return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
20
21sim_alice_bob = cosine_sim(alice, bob)
22sim_alice_charlie = cosine_sim(alice, charlie)
23print(f"Alice & Bob Similarity: {sim_alice_bob:.3f}")
24print(f"Alice & Charlie Similarity: {sim_alice_charlie:.3f}")
⚑ How to Run in Google Colab (3 Quick Steps)
  1. Click "Copy for Google Colab" above.
  2. Click Open New Google Colab Notebook (opens in a new tab).
  3. Click on the first empty code cell, press Ctrl + V (or Cmd + V) to paste, then press Shift + Enter to execute!

πŸ”„ Algorithmic Execution Flow

1
Vectorization

User tastes are encoded into numerical vector representations.

β†’
2
Geometric Angle Measurement

Cosine similarity measures the angle between vectors independent of scale.

β†’
3
Affinity Ranking

Higher cosine score indicates closer alignment in consumer taste.

πŸ“₯ Input / Initial State
User preference vectors in 4-dimensional genre space
πŸ“€ Expected Output
Alice & Bob Similarity: 0.985
Alice & Charlie Similarity: 0.177
πŸ’‘ What Does This Demonstration Show?

Alice and Bob have a near-perfect similarity score of 0.985, meaning their taste profiles strongly correlate, whereas Charlie only scores 0.177.

Course Learning Resource β€’ Slide DeckLesson 119 Slides

Lesson 1: First Steps in Quantum Computing & AI

From classical prediction to a one-qubit quantum circuit.

Author: Dr. Syed Muzamil Bashaβ€’ FDP Approved Curriculum
Open in New Tab

πŸ“ Learning Check

Test your understanding with these questions. Remember, this is for learning, not examination!

Question 1: Which recommendation technique relies on similarities between item attributes (e.g. director, genre, actors)?

Question 2: Why is AI crucial for real-time financial fraud detection?

Question 3: In collaborative filtering, a recommendation for user Bob is based on which factor?

Question 4: Given two user preference vectors: Alice = [5, 5, 1, 1] and Charlie = [1, 0, 5, 4] for genres [Action, SciFi, Comedy, Drama], what does a cosine similarity close to 0 indicate?

Question 5: In a real-world AI recommendation pipeline, what is the role of the "Candidate Generation" stage?

Question 6: Google Maps predicts your arrival time with high accuracy despite unpredictable traffic. Which AI technique is most responsible for this?

Question 7: The formula rΜ‚_ui = ΞΌ + b_u + b_i + p_u^T q_i is used in collaborative filtering. What do the latent vectors p_u and q_i represent?