小编Pro*_*eos的帖子

Python中大数的高斯核密度估计(KDE)

我有1000个大数,随机分布在37231到56661之间.

我试图使用stats.gaussian_kde但有些东西不起作用.(也许是因为我对统计学知识不足?)

这是代码:

from scipy import stats.gaussian_kde
import matplotlib.pyplot as plt

# 'data' is a 1D array that contains the initial numbers 37231 to 56661
xmin = min(data)
xmax = max(data)   

# get evenly distributed numbers for X axis.
x = linspace(xmin, xmax, 1000)   # get 1000 points on x axis
nPoints = len(x)

# get actual kernel density.
density = gaussian_kde(data)
y = density(x)

# print the output data
for i in range(nPoints):
    print "%s   %s" % …
Run Code Online (Sandbox Code Playgroud)

python statistics matplotlib scipy

4
推荐指数
1
解决办法
5865
查看次数

标签 统计

matplotlib ×1

python ×1

scipy ×1

statistics ×1