Get started with Ray, the open source distributed computing framework that simplifies the process of scaling compute-intensive Python workloads. With this practical book, Python programmers, data engineers, and data scientists will learn how to leverage Ray locally and spin up compute clusters. You'll be able to use Ray to structure and run machine learning programs at scale.
Authors Max Pumperla, Edward Oakes, and Richard Liaw show you how to build machine learning applications with Ray. You'll understand how Ray fits into the current landscape of machine learning tools and discover how Ray continues to integrate ever more tightly with these tools. Distributed computation is hard, but by using Ray you'll find it easy to get started.
• Learn how to build your first distributed applications with Ray Core
• Conduct hyperparameter optimization with Ray Tune
• Use the Ray RLlib library for reinforcement learning
• Manage distributed training with the Ray Train library
• Use Ray to perform data processing with Ray Datasets
• Learn how work with Ray Clusters and serve models with Ray Serve
• Build end-to-end machine learning applications with Ray AIR
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Learning Ray: A Practical Guide to Distributed Python for Machine Learning
## 【One-Line Pitch】
A hands-on guide for Python programmers, data engineers, and data scientists who want to scale their machine learning workloads from a single laptop to distributed clusters using Ray's unified ecosystem of libraries—covering everything from core distributed computing to training, tuning, and serving models.
## 【Book Arc】
- **Opening (~0%–9%)**: Introduces Ray's three-layer architecture—the core distributed engine, high-level data science libraries (Ray Data, Train, Tune, RLlib, Serve), and the growing ecosystem of integrations. Sets up the book's promise: making distributed Python accessible for ML workloads.
- **Early (~9%–28%)**: Walks through each high-level library with first code examples—RLlib for reinforcement learning with a pendulum control problem, Tune for hyperparameter optimization, and Serve for model serving with GPT-2. Establishes the "distributed by construction" design philosophy.
- **Early (~28%–38%)**: Explains how Ray acts as a distributed interface over existing tools rather than replacing them—integrating TensorFlow/PyTorch for training, Hyperopt/Optuna for tuning, and Arrow/Spark/Dask for data processing. This "common interface" pattern is a recurring theme.
- **Middle (~38%–53%)**: Dives into Ray Core fundamentals, starting with the Python GIL problem and why distributed computing matters. Introduces the `@ray.remote` decorator for turning Python functions into remote tasks, plus blocking vs. non-blocking calls with `ray.get` and `ray.wait`.
- **Middle (~53%–end)**: Covers Ray Train for distributed model training (including gradient boosted trees and deep learning), Ray Datasets for data processing with parallel SGD examples, and advanced features like checkpoints, callbacks, and Tune integration.
## 【Key Takeaways】
- **Ray's three-layer design separates concerns** (Early): The core engine handles distributed execution, high-level libraries handle ML-specific tasks, and the ecosystem provides integrations—so you can start with libraries and drop to core only when needed.
- **Distributed Python is hard, but Ray makes it approachable** (Early): By leveraging familiar Python tools and providing clean abstractions, Ray lowers the barrier to cluster computing for data scientists who don't want to become distributed systems engineers.
- **The GIL is the fundamental reason you need Ray** (Middle): Python's Global Interpreter Lock limits CPU-bound parallelism to a single thread; Ray sidesteps this by distributing tasks across processes and machines rather than threads.
- **One decorator changes everything** (Middle): Adding `@ray.remote` to any Python function turns it into a distributed task—the simplest possible entry point into Ray's parallelism model.
- **Non-blocking execution matters for real workloads** (Middle): Using `ray.wait` instead of `ray.get` lets you process results as they arrive and handle partial failures, which is critical when tasks take minutes or hours.
- **Ray integrates rather than replaces** (Early): Ray Tune unifies HPO tools like Hyperopt and Optuna, Ray Train wraps TensorFlow/PyTorch, and Ray Data builds on Arrow—so you keep your existing toolchain while gaining distribution.
- **Hyperparameter search is dramatically faster with Tune** (Early): A grid search that would take 4+ minutes sequentially runs in ~35 seconds on a laptop with Ray's parallelization—and scales to hours-long training runs with more sophisticated methods.
## 【Reading Tips】
- **Skim Chapter 1** for the big picture and library overviews; you'll return to it as a reference when you need to pick the right tool for a task.
- **Deep-read Chapter 2** on Ray Core—the GIL discussion and `@ray.remote` examples are foundational for everything that follows.
- **Pay attention to the "distributed interface" pattern** (around 38%): it explains why Ray works well with your existing ML stack and how to think about extending it.
- **Don't skip the pendulum RLlib example** (around 28%): it's the simplest complete RL workflow and demonstrates the command-line-to-Python-API progression you'll use later.
- **The excerpts don't cover Ray Cluster setup or Ray Serve in depth**—if those are your primary interests, you'll need to consult the full book or supplementary documentation.
## 【Coverage Limits】
This guide synthesizes the first ~53% of the book (through Ray Core fundamentals). Later chapters on Ray Train, Ray Datasets, Ray Clusters, Ray Serve, and Ray AIR are referenced but not covered in detail here.
##
Page 4
11 A Distributed Computing Framework 11 A Suite of Data Science Libraries ...
o build and run complex AI applications at scale, and rein‐ forcement learning has been an integral part of Ray from the start. Three Layers: Core, Libraries...
s example was to show you how simple it can be to train and evaluate reinforcement learning tasks with RLlib, using just two command line calls to rllib. Dis...
, consider using an implementa‐ tion different from CPython. CPython is Python’s standard implementation, and if you don’t know that you’re using it, you’re ...
an object store loosely, without really specifying it. Each node of a Ray cluster is equipped with an object store, within that node’s Raylet, and all object...
o implement an algorithm that figures out on its own how to play the game, merely by playing the game repeatedly: observing what’s happening, deciding what t...
and is worth reading for context. Recapping RL Terminology Before we wrap up this chapter, let’s discuss the concepts we’ve encountered in the maze example i...
creates checkpoints of the algorithm automatically for us. From the output of that training script you should see that Ray will write training results to a l...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Learning Ray, 5th Early Release (Max Pumperla, Edward Oakes, Richard Liaw)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Learning Ray, 5th Early Release (Max Pumperla, Edward Oakes, Richard Liaw)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Learning Ray, 5th Early Release (Max Pumperla, Edward Oakes, Richard Liaw)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
这本书围绕开源分布式计算框架 Ray 展开,面向 Python 程序员、数据工程师和数据科学家,讲解如何借助 Ray 简化计算密集型 Python 工作负载的扩展过程。它从 Ray 的由来切入,说明这一框架要解决的是分布式系统编程过于复杂的问题,并给出理解 Ray 的整体框架:核心引擎、高层库与生态系统三个层次。正文摘录提到,强化学习从最初就是 Ray 的重要组成部分,构建和运行大规模复杂 AI 应用是它要应对的场景,而 Ray 的众多扩展工具也可以在生态图示中辨认出来。
沿着这一框架,读者可以抓住几条主要线索。其一是 Ray Core 的基本机制,包括集群的构成方式,以及每个节点上 Raylet 内部所配备的对象存储,这些分布在各节点上的对象存储共同组成整个集群的分布式对象存储。其二是分布式编程的具体写法与取舍,比如远程函数的定义方式、阻塞与非阻塞调用的区别、Actor 模型以及嵌套任务等,这些内容为后续使用高层库打下基础。其三是高层库的定位与典型用例,书中逐一介绍它们各自适合解决什么问题,其中强化学习部分以一个迷宫环境的实现为例,说明所采用的是 Q-Learning 算法,并展示训练脚本如何自动生成检查点,把训练结果写...
Digital LibraryAI Assistant
Hi — I can help you pick a book. Tell me a topic, language, or level, e.g. “a light English read”. If that's too broad, I'll ask one follow-up.
Loading comments...
Reply to Comment
Edit Comment