Lesson 6 of 12
AI in Entertainment
Entertainment is one of the areas where AI is most visible to everyday users. Recommendation systems, content generation, and game AI are all changing how people experience entertainment.
Recommendation Systems
Every major streaming platform uses AI to decide what to show you.
How it works:
- Collaborative filtering: find users similar to you. Show what they liked
- Content-based filtering: analyze the features of what you liked. Find similar content
- Hybrid models: combine both for better results
Netflix estimates that its recommendation system saves $1 billion per year by reducing subscriber churn. People who cannot find anything to watch cancel their subscriptions.
80% of what people watch on Netflix is recommended by the AI. Only 20% comes from active search.
Educational visual guide for ai in entertainment.
Entertainment AI Applications
- Music recommendations: Spotify Discover Weekly generates a personalized playlist every Monday based on your listening patterns
- Game AI: NPC characters use behavior trees and increasingly ML to respond realistically to player actions
- Game content generation: AI generates terrain, dungeons, and levels procedurally, creating nearly infinite unique environments
- Visual effects: AI tools remove background noise from dialogue, upscale old footage to 4K, and de-age actors
- Script analysis: studios use AI to predict which scripts are likely to be commercially successful
- Soundtrack composition: AI tools generate background music in any style for games and video content
Simple Recommendation System
# Simple collaborative filtering recommendation system
# User ratings: 1-5 stars, 0 = not watched
ratings = {
"Alice": {"The Matrix": 5, "Inception": 4, "Interstellar": 5, "Avengers": 2},
"Bob": {"The Matrix": 4, "Inception": 5, "Interstellar": 4, "Avengers": 3, "Dunkirk": 5},
"Carol": {"Avengers": 5, "Spider-Man": 5, "Thor": 4, "Inception": 2},
"David": {"The Matrix": 5, "Inception": 4, "Dunkirk": 4}, # Similar to Alice
}
def cosine_similarity(user1_ratings, user2_ratings):
"""Calculate similarity between two users based on shared ratings."""
common = set(user1_ratings) & set(user2_ratings)
if not common:
return 0
dot = sum(user1_ratings[m] * user2_ratings[m] for m in common)
mag1 = sum(v**2 for m, v in user1_ratings.items() if m in common) ** 0.5
mag2 = sum(v**2 for m, v in user2_ratings.items() if m in common) ** 0.5
return dot / (mag1 * mag2) if (mag1 * mag2) > 0 else 0
def recommend(target_user, all_ratings, top_n=2):
"""Recommend movies the target user has not seen yet."""
target_ratings = all_ratings[target_user]
# Find most similar user
similarities = {}
for user, user_ratings in all_ratings.items():
if user != target_user:
sim = cosine_similarity(target_ratings, user_ratings)
similarities[user] = sim
most_similar_user = max(similarities, key=similarities.get)
sim_score = similarities[most_similar_user]
# Find movies similar user rated highly that target has not seen
similar_ratings = all_ratings[most_similar_user]
unseen = {m: r for m, r in similar_ratings.items() if m not in target_ratings and r >= 4}
# Sort by rating
recommendations = sorted(unseen.items(), key=lambda x: x[1], reverse=True)[:top_n]
return most_similar_user, sim_score, recommendations
# Get recommendations for David
user = "David"
similar_user, sim, recs = recommend(user, ratings)
print(f"Recommendation System for: {user}")
print(f" Watched: {list(ratings[user].keys())}")
print(f" Most similar user: {similar_user} (similarity: {sim:.2f})")
print(f" Recommended movies:")
for movie, rating in recs:
print(f" {movie} (rated {rating} by {similar_user})")Key Takeaways
- Entertainment is one of the areas where AI is most visible to everyday users.
- Music recommendations: Spotify Discover Weekly generates a personalized playlist every Monday based on your listening patterns
- Game AI: NPC characters use behavior trees and increasingly ML to respond realistically to player actions
- Game content generation: AI generates terrain, dungeons, and levels procedurally, creating nearly infinite unique environments
Finished this lesson?