不确定性间隔

2024-04-26 10:59:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我将看到数据集合的行为。可视化集合的更好方法是使用各种不确定性区间和平均值。我们可以使用st.Scoreat百分位数“但是使用下面的代码时,我遇到了一个错误,并且没有绘制图形。你知道吗

import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as st

# generate some data
x = 100*np.sin([np.linspace(0,10,100)])
X = np.vstack([x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x])
e = 10*np.random.randn(20,100)
X_err = X+e
ll = st.scoreatpercentile(X_err, 10) # 10th percentile
ml = st.scoreatpercentile(X_err, 50) # 50th percentile
ul = st.scoreatpercentile(X_err, 90) # 90th percentile

plt.plot(ml,'g', lw=2, label= ' Median ' )
plt.plot(ul,'r', label= ' 90% ' )
plt.plot(ll,'b', label= ' 10% ' )
plt.xlabel( ' Time ' )
plt.ylabel( ' X ' )
plt.legend(loc= 'best' )
plt.show()

Tags: 数据importplot可视化asnppltul