max(count)* fit / max(fit)应该是什么意思? “适合”一词应该传达什么?

问题描述 投票:1回答:1

docs.scipy.org中,有一个代码可以生成帕累托分布。我可以理解大多数代码片段,除了对PDF(概率密度函数)使用术语“适合”和以下公式:max(count)* fit / max(fit)

这是代码段:

import matplotlib.pyplot as plt
a, m = 3., 2.  # shape and mode
s = (np.random.pareto(a, 1000) + 1) * m
count, bins, _ = plt.hist(s, 100, normed=True)
fit = a*m**a / bins**(a+1)
plt.plot(bins, max(count)*fit/max(fit), linewidth=2, color='r')
plt.show()

我在网上彻底搜索了以下公式:max(count)* fit / max(fit)甚至用pdf代替了“适合”一词。但是没有任何线索。请解释公式所传达的概念。

我假设使用术语“拟合”代替PDF,因为他们使用PDF的公式进行Pareto分布拟合。

最后,代码中的下划线'_'传达了什么:

count, bins, _ = plt.hist(s, 100, normed=True)
python matplotlib distribution pareto-chart
1个回答
1
投票
np.random.pareto从Pareto-II分布中抽取随机样本。因此,所得数据是该分布的实现,而不是分布的概率密度。

在对plt.hist的调用中,我们使用normed=True参数。这将对数据进行归一化,并在y轴上而不是频率上绘制我们样本的

密度

© www.soinside.com 2019 - 2024. All rights reserved.