Skip to Content
机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
book

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

by Aurélien Géron
October 2020
Intermediate to advanced
693 pages
16h 26m
Chinese
China Machine Press
Content preview from 机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)
大规模训练和部署
TensorFlow
模型
577
response.raise_for_status()
# raise an exception in case of error
response = response.json()
响应是一个包含 "predictions" 键的字典。对应的值是预测列表。该列表是 Python
列表,因此我们将其转换为 NumPy 数组,并将其包含的浮点数舍入到第二个小数:
>>>
y_proba = np.array(response["predictions"])
>>>
y_proba.round(2)
array([[0. , 0. , 0. , 0. , 0. , 0. , 0. , 1. , 0. , 0. ],
[0. , 0. , 0.99, 0.01, 0. , 0. , 0. , 0. , 0. , 0. ],
[0. , 0.96, 0.01, 0. , 0. , 0. , 0. , 0.01, 0.01, 0. ]])
我们得到预测了!该模型 100% 确信第一幅图像是 799% 确信第二幅图像是 2,以及
96% 确信第三幅图像是 1
REST API 非常好用和简单,当输入和输出数据不太大时,它可以很好地工作。而且几
乎任何客户端应用程序都可以进行 REST 查询而没有其他依赖关系,而其他协议并非总
是那么容易获得的。但是它基于 JSON,是文本格式且相当冗长。我们必须将 NumPy
组转换为 Python 列表,并且每个浮点数最终都表示为字符串 ...
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

算法技术手册(原书第2 版)

算法技术手册(原书第2 版)

George T.Heineman, Gary Pollice, Stanley Selkow
Go语言编程

Go语言编程

威廉·肯尼迪
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey

Publisher Resources

ISBN: 9787111665977