Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.
Explore the ubiquitous presence of AI in daily life, from search algorithms and streaming recommendations to facial recognition and smart assistants.
| Symbol / Term | Meaning | Beginner Interpretation |
|---|---|---|
| Predicted rating | Estimated score user u will assign to item i | |
| Global mean rating | Average rating across all items and users | |
| User & item biases | Baseline tendencies (e.g. strict rater vs popular movie) | |
| Latent vectors | Mathematical embeddings capturing user preferences and item traits |
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.
Result: Predicted rating is 4.7 / 5.0 (Strongly Recommended)
User clicks, pauses, and queries are streamed via message brokers like Apache Kafka.
A lightweight algorithm selects the top 500 candidate items out of millions.
A neural model scores and ranks the top candidates using hundreds of contextual features.
The personalized UI renders items with the highest predicted engagement.
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.
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.
Interactive activity component
Calculate cosine similarity between user preference vectors to recommend items.
For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:
!pip install numpy1 import numpy as np
import numpy as np β Import NumPy for high-performance vector math
1 # User ratings on 4 movie genres: [Action, SciFi, Comedy, Drama] 2 alice = np.array([5.0, 5.0, 1.0, 1.0]) 3 bob = np.array([4.0, 5.0, 2.0, 1.0]) 4 charlie = np.array([1.0, 0.0, 5.0, 4.0]) 5 6 def cosine_sim(a, b): 7 return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b)) 8 9 sim_alice_bob = cosine_sim(alice, bob) 10 sim_alice_charlie = cosine_sim(alice, charlie) 11 print(f"Alice & Bob Similarity: {sim_alice_bob:.3f}") 12 print(f"Alice & Charlie Similarity: {sim_alice_charlie:.3f}")
# 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
Click "Copy for Colab", open Google Colab, paste into a single cell, and run.
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 10 import numpy as np 11 12 # Step 3: Run Demonstration 13 # User ratings on 4 movie genres: [Action, SciFi, Comedy, Drama] 14 alice = np.array([5.0, 5.0, 1.0, 1.0]) 15 bob = np.array([4.0, 5.0, 2.0, 1.0]) 16 charlie = np.array([1.0, 0.0, 5.0, 4.0]) 17 18 def cosine_sim(a, b): 19 return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b)) 20 21 sim_alice_bob = cosine_sim(alice, bob) 22 sim_alice_charlie = cosine_sim(alice, charlie) 23 print(f"Alice & Bob Similarity: {sim_alice_bob:.3f}") 24 print(f"Alice & Charlie Similarity: {sim_alice_charlie:.3f}")
User tastes are encoded into numerical vector representations.
Cosine similarity measures the angle between vectors independent of scale.
Higher cosine score indicates closer alignment in consumer taste.
User preference vectors in 4-dimensional genre space
Alice & Bob Similarity: 0.985 Alice & Charlie Similarity: 0.177
Alice and Bob have a near-perfect similarity score of 0.985, meaning their taste profiles strongly correlate, whereas Charlie only scores 0.177.
From classical prediction to a one-qubit quantum circuit.
Test your understanding with these questions. Remember, this is for learning, not examination!