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数据科学实战
数据的输入与输出
|
3
第一次查看数据集时,可能已经有复杂的数据模型,或者只是文本、整数、
double
型以及日
期时间型数据的混合体。理想情况下,当确定了要将哪些数据输入到统计分析算法或者学习
算法中时,这些数据已经被转换为二维数组,数组的元素是
double
型。然而,需要大量工
作才能达到这一步。一方面,以矩阵的形式提供数据,从而采用机器学习方法取得进展是方
便的;另一方面,可能不知道需要做哪些折中,或者已经扩散了哪些未被检测到的错误。
1.2.3
 数据对象
另一种选择是创建容器类,然后把这些容器对象添加到
List
或
Map
等集合中。这样做的优
点是,将一条特定记录的所有值保持在一起,向类中添加新成员时,不会破坏任何以这个
类作为参数的方法。文件
somefile.txt
中的数据可以用下面的类表示:
class Record
{
int
id;
int
year;
String city;
}
确保该类尽可能是轻量级的,因为包含这些对象的集合(
List
或
Map
)会形成大的数据
集。理想情况下,任何作用在
Record
对象上的方法应该都是其所属类(该类可能命名为
RecordUtils
)中的静态方法。
集合结构
List
用来存放所有
Record
对象。
List<Record> listOfRecords =
new
ArrayList<>();
采用
BufferedReader
遍历数据文件时,会对每一行进行解析,并将其内容存放在新的
Record
实例中,再把每个新的
Record
实例添加到
List<Record> listOfRecords ...
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