gpt4 book ai didi

python - Seaborn.Regplot 中的线条代表什么

转载 作者:太空狗 更新时间:2023-10-30 00:53:37 31 4
gpt4 key购买 nike

我很好奇 seaborn.regplot 中突出显示的线条代表什么。我无法在文档中找到答案。

谢谢

enter image description here

最佳答案

实线显然是线性回归模型拟合。

然而,半透明带线描述了为估计生成的自举置信区间。来自 the docs我们可以在 ci 的参数信息中看到:

(强调我的)

ci : int in [0, 100] or None, optional

Size of the confidence interval for the regression estimate. This will be drawn using translucent bands around the regression line. The confidence interval is estimated using a bootstrap; for large datasets, it may be advisable to avoid that computation by setting this parameter to None.

因此,如果您不希望执行 Bootstrap 的开销来获取这些 CI 带,只需传递 ci=None


示例

import seaborn as sns
import matplotlib.pyplot as plt

sns.set_palette(sns.cubehelix_palette(8, light=.6))

tips = sns.load_dataset('tips')
x = 'total_bill'
y = 'tip'
cis = [None, 67, 99]
titles = ['No CI', '67% CI', '99% CI']

fig, axes = plt.subplots(nrows=3, sharey=True, sharex=True, figsize=(7, 10))

for ci, title, ax in zip(cis, titles, axes):
sns.regplot(x = x,
y = y,
data = tips,
ax = ax,
ci = ci).set_title(title)

plt.tight_layout()
plt.show()

CI examples

关于python - Seaborn.Regplot 中的线条代表什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45525725/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com