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数据科学实战
统计学
|
67
5.
经验分布
在一些场合中,虽然有数据,但是不知道数据服从什么分布。此时仍然可以根据数据
近似出分布,甚至计算出概率密度、累积概率以及随机数。使用经验分布的第一步工
作是,把数据搜集到若干相同大小的桶(
bin
)中,所有这些桶涵盖整个数据集的范围。
EmpiricalDistribution
类可以输入
double
型数组,装载本地文件,或者根据
URL
装载文
件。在这些情况下,数据的每行必须只有一项。
/* 从标准正态分布中获得2500个随机数 */
NormalDistribution nd =
new
NormalDistribution();
double
[] data = nd.sample(2500);
// 默认的构造方法设置(桶数 = 1000)
// 尝试一下(点数/10)会更好
EmpiricalDistribution dist =
new
EmpiricalDistribution(25);
dist.load(data); // 也可以从文件或者URL装载数据
double
lowerBound = dist.getSupportLowerBound(); // 0.5
double
upperBound = dist.getSupportUpperBound(); // 10.1
double
mean = dist.getNumericalMean(); // 5.48
double
variance = dist.getNumericalVariance(); ...
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