Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Bryan Bischof, Hector Yee

Rating No ratings yet

Implementing and designing systems that make suggestions to users are among the most popular and essential machine learning applications available. Whether you want customers to find the most appealing items at your online store, videos to enrich and entertain them, or news they need to know, recommendation systems (RecSys) provide the way. In this practical book, authors Bryan Bischof and Hector Yee illustrate the core concepts and examples to help you create a RecSys for any industry or scale. You'll learn the math, ideas, and implementation details you need to succeed. This book includes the RecSys platform components, relevant MLOps tools in your stack, plus code examples and helpful suggestions in PySpark, SparkSQL, FastAPI, and Weights & Biases. You'll learn: The data essential for building a RecSys How to frame your data and business as a RecSys problem Ways to evaluate models appropriate for your system Methods to implement, train, test, and deploy the model you choose Metrics you need to track to ensure your system is working as planned How to improve your system as you learn more about your users, products, and business case

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on guide for engineers and data scientists who want to design, build, and deploy production-grade recommendation systems using Python, JAX, and modern MLOps tools—covering everything from data collection to model serving and beyond. 【Book Arc】 - **Opening (~0%–9%)**: Introduces the core components of a recommendation system (collector, ranker, server) and outlines the book's scope, including the tech stack (PySpark, SparkSQL, FastAPI, Weights & Biases) and the progression from toy examples to advanced topics like sequential recommenders and LLM applications. - **Early (~9%–25%)**: Establishes foundational concepts: JAX basics (random keys, JIT compilation), data types (soft ratings, click-stream data, add-to-bag signals), and the importance of user logging and instrumentation for collecting meaningful interaction data. - **Early (~25%–34%)**: Delves into mathematical underpinnings—similarity measures, latent spaces, and the Netflix Prize as a historical case study—explaining why these concepts drive architectural decisions and can lead to pathological behavior if mishandled. - **Middle (~34%–47%)**: Moves into practical implementation: collaborative filtering formulas (Pearson correlation), the NLP-RecSys relationship, and the distinction between offline and online servers for enforcing business logic and experimentation. Includes concrete code examples for building models with Flax and JAX. - **Middle (~47%–53%)**: Covers the full training pipeline—input pipelines, CNN architectures for visual recommendations (e.g., "Shop the Look"), checkpointing, evaluation loops, and hyperparameter sweeps—demonstrating how to integrate with tools like Weights & Biases for experiment tracking. - **Late (~53%–end)**: Explores advanced topics: acceleration structures for retrieval at scale (sharding, LSH, k-d trees, hierarchical k-means), sequential recommenders (Markov chains, RNN/CNN/attention architectures like BERT4Rec), and future directions including multimodal, graph-based, and LLM-powered recommenders. 【Key Takeaways】 - **Recommendation systems have three universal components** (Early): collector, ranker, and server—even a trivial random recommender fits this framework, making it a useful mental model for designing any RecSys. - **JAX's key-based random number generation ensures reproducibility** (Early): splitting keys for parallel operations allows deterministic results across CPUs, GPUs, and TPUs, which is critical for reliable experiments and production training. - **Click data often beats explicit ratings for training** (Early): clicks are upstream of purchases, require active user intent, and come in higher volume—making them the go-to signal for many production systems, with add-to-bag being an even stronger indicator. - **Impressions provide valuable negative feedback** (Early): logging items shown but not clicked helps the system learn user disinterest, though this signal can be noisy (e.g., a user may not have gotten around to trying an item). - **Similarity in high-dimensional latent spaces is tricky** (Middle): Euclidean distance degrades as dimensions grow, so cosine similarity is often preferred; averaging user preferences can fail for users with diverse tastes, suggesting item-specific or weighted approaches instead. - **Offline and online servers split responsibilities** (Middle): the offline server handles schema, business rules (e.g., "never pair these items"), and experimentation logic, while the online server applies final rules like diversification to ranked lists in real time. - **Visual recommendation models require careful input normalization** (Middle): scaling images to floating-point values around zero (roughly –1 to 1) aligns with neural network initialization assumptions, improving training stability for CNNs built with Flax. - **Scaling retrieval demands specialized acceleration structures** (Late): sharding, locality-sensitive hashing, k-d trees, and hierarchical k-means are essential for moving from exhaustive search to fast, approximate retrieval in large catalogs. 【Reading Tips】 - **Skim the early JAX primer** (~9%–19%) if you're already familiar with NumPy and functional programming; focus instead on the key-splitting and JIT compilation sections, which are unique to JAX and essential for later code. - **Deep-read the mathematical chapter** (~25%–34%) even if you're implementation-focused—it explains why certain architectural choices (like cosine similarity over Euclidean distance) are made, which will save you debugging time later. - **Use the middle chapters as a reference during your own projects** (~34%–53%): the code examples for training loops, checkpointing, and hyperparameter sweeps are practical templates you can adapt, but don't try to memorize them—return when you need them. - **Pay special attention to the offline/online server distinction** (~38%–44%): this is a production pattern that's often glossed over in other RecSys books but is crucial for deploying models that respect business constraints. - **Treat the final chapters as a survey** (~53%–end): you don't need to master every advanced topic (e.g., BERT4Rec or graph neural networks), but skim them to understand what's possible and which direction to explore for your specific use case. 【Coverage Limits】 This guide synthesizes the book's core progression from fundamentals to advanced topics, but the excerpts do not cover every code example, dataset walkthrough, or detailed evaluation metric discussion in the full text—readers should consult the book for complete implementations and deeper dives into specific algorithms.
Excerpt 1
4 Ranker 4 Server 4 Simplest Possible Recommenders 5 The Trivial Recommender 5 Most-Popular-Item Recommender 6 A Gentle Introduction to JAX 7 Basic Types, In...
View in text
Excerpt 2
. Conditional upon the availability, the collection of rec‐ ommendable things is either [item_id] or None (recall that None is a collection in the set-theore...
View in text
Excerpt 3
istical inclination. Finally, we’ll use analogies to NLP to formulate the popular approach. Zipf’s Laws in RecSys and the Matthew Effect In a great many appl...
View in text
Excerpt 4
n.Module): """Shop the look model that takes in a scene and item and computes a score for them. output_size : int def setup(self): default_filter = [16, 32,...
View in text
Excerpt 5
function—which happens to be the transpose of the gradient. This is the simplest case; the gradient of a multivariable scalar func‐ tion may be written as a...
View in text
Excerpt 6
cripts against the model, checking the typed output of data transformations, or running validation sets through the model and benchmarking the performance ag...
View in text
Excerpt 7
nfidence that we can serve up our recommendations, and even better, we have instrumented our system to gather feedback. We’ve shown how you can gain confiden...
View in text
Excerpt 8
systems with what can be considered the naive ML approaches. Via these approaches, we will start to get a sense of where the rub lies in building recommendat...
View in text
Tags
AI categories
Artificial IntelligencePythonMachine Learning
ISBN: 1492097993
Publisher: O'Reilly Media
Publish Year: 2024
Language: English
Pages: 355
File Format: PDF
File Size: 10.3 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…