首页 > 解决方案 > 如何从 Seaborn lmplot() 中提取线性模型参数?

问题描述

seaborn.lmplot()有没有办法提取适合给定数据集的回归线的参数?我查阅了文档,但在这方面没有发现任何对我有帮助的东西。

为了清楚起见,我不是指lmplot()' 函数参数,而是m,
bof y = mx + b

标签: pythonseabornlinear-regression

解决方案


seaborn 使用 scipy stats linregress,所以你可以直接从那里得到它。

from scipy import stats
slope, intercept, r_value, p_value, std_err = stats.linregress(df.x,df.y)

推荐阅读