【发布时间】:2020-03-09 14:06:34
【问题描述】:
在docs.scipy.org 中有一个生成帕累托分布的代码。我可以理解大部分代码 sn-p 除了对 PDF(概率密度函数)使用术语“拟合”和公式:max(count)*fit/max(fit)
这里是sn-p的代码:
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 的公式进行帕累托分布进行拟合。
最后,代码中的下划线'_'表达了什么:
count, bins, _ = plt.hist(s, 100, normed=True)
【问题讨论】:
-
_表明该值并不重要。plt.hist会返回三个值,最后一个不重要
标签: python matplotlib distribution pareto-chart