Skip to Main Content
机器学习设计模式
book

机器学习设计模式

by Valliappa Lakshmanan, Sara Robinson, Michael Munn
September 2022
Beginner to intermediate content levelBeginner to intermediate
386 pages
7h 36m
Chinese
Southeast University Press
Content preview from 机器学习设计模式
可复现设计模式
277
anomalies = (windowed
| 'latest_slice' >> beam.FlatMap(is_latest_slice)
| 'find_anomaly' >> beam.Map(is_anomaly, model_external))
请注意,该操作小心地将计算开销大的训练从计算开销小的推理中分离出来。计算
开销大的部分每
10
分钟只执行一次,同时可以将每个实例分类为异常或非异常。
高吞吐量数据流。
数据量持续增长,而且大部分增长的数据量是由于实时数据。因此,
这种模式必须应用于高吞吐量数据流——这些数据流中每秒的元素数量可能超过数
千个。例如,想想来自网站的点击数据流或来自计算机、可穿戴设备或汽车的机器
运行数据流。
使用流式管道的建议解决方案的优点是它避免了在每个实例中对模型重新训练,不
像“问题”说明部分
pandas
代码所做的那样。然而,建议的解决方案通过创建一个
接收到所有数据记录的内存数据帧来重新获得这些优点。如果我们每秒收到
5000
数据,那么
10
分钟内的内存数据帧将包含
300
万条记录。因为在任意时间点上(
10
分钟的窗口,每个持续
2
小时)有
12
个滑动窗口需要维持,内存需求会变得相当大。
存储所有接收到的记录以便在窗口的最后计算模型参数,这可能会产生问题。当
数据流的吞吐量较高时,能够使用每个元素更新模型参数就变得非常重要。这可
以通过以如下方式更改
ModelFn
来实现
(完整代码在
GitHub
上,
https://github. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PyTorch深度学习

PyTorch深度学习

Posts & Telecom Press, Vishnu Subramanian
数据科学原理

数据科学原理

Posts & Telecom Press, Sinan Ozdemir
Rust程序设计

Rust程序设计

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall

Publisher Resources

ISBN: 9787564196776