Skip to Content
Java数据科学实战
book

Java数据科学实战

by Michael R. Brzustowicz, PhD
January 2020
Intermediate to advanced
202 pages
5h 41m
Chinese
Posts & Telecom Press
Content preview from Java数据科学实战
91
第 4 章
数据操作
既然你已经知道如何把数据输入到有用的数据结构中,就可以利用所掌握的线性代数与统
计学知识对数据进行操作。把数据提交给学习算法之前,可以对数据进行多种操作,这通
常称为
预处理
(
preprocessing
)。预处理包括数据清理、对数据归一化或缩放、把数据归约
至较小的规模、把文本值编码为数字值,以及把数据拆分为不同部分以用于训练模型与测
试模型。通常,数据已经具有一种或者另一种格式(例如
List
或
double[][]
),学习例程
可能采用任何一种格式,或者两种格式都用。此外,学习算法可能需要知道标签是二值的
还是多类别的,或者是采用其他方式编码的,例如文本。上述这些都需要考虑,并且要在
数据进入学习算法之前做好准备。对于从源头得到原始数据,然后将其准备好用于学习算
法或预测算法的这一自动化工作流程,本章的步骤可以成为其中的一部分。
4.1
 转换文本数据
许多学习算法或预测算法都需要数值输入。完成这一操作最简单的方式之一是创建向量空
间模型,在其中定义一个已知维数的向量,然后把文本片段(乃至单词)的集合赋值给对
应的向量集合。把文本转换为向量的一般过程有多种选择和变体。此处假定存在大量文本
(语料库),可以把它们划分为句子或行(文档),然后进一步分为单词(标记)。注意
语料
库
(
corpus
)、
文档
(
document
)以及标记(
token
)由用户定义。
4.1.1
 从文档中提取标记
对于每个文档,需要提取所有标记。因为有许多方法来处理这个问题,所以可以创建一个
接口。该接口有个方法,该方法以文档字符串为输入,返回由 ...
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

云安全实用指南

云安全实用指南

Chris Dotson
Kafka权威指南

Kafka权威指南

Neha Narkhede, Gwen Shapira, Todd Palino

Publisher Resources

ISBN: 9787115533302