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
加载和预处理数据
377
SequenceExample 包含一个用于上下文数据的 Feature 对象和一个 FeatureLists
对象(包含一个或多个命名的 FeatureList 对象(一个名为“ content”,另一个名为
comments”)) FeatureList 包含一个 Feature 对象的列表,每个对象可以是
一个字节字符串列表、一个 64 位整数列表或一个 float 列表(在本示例中,每个 Feature
代表一个句子或一个注释,可能是以字标识符列表的形式)。构建 SequenceExample
对其进行序列化和解析的过程与构建 Example 对其进行序列化和解析相似,但是你必须
使用tf.io.parse_single_sequence_example() 解析单个SequenceExample
或者使用 tf.io.parse_sequence_example() 来解析批处理。这两个函数都返回一
个包含上下文特征(作为字典)和特征列表(也作为字典)的元组。如果特征列表包含大
小不同的序列(如上例所示),则可能需要使用 tf.RaggedTensor.from_sparse()
将它们转换为不规则的张量(有关完整代码,请参见 notebook):
parsed_context, parsed_feature_lists = tf.io.parse_single_sequence_example(
serialized_sequence_example, ...
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