【问题标题】:How to Extract Linear Model Parameters from Seaborn lmplot()?如何从 Seaborn lmplot() 中提取线性模型参数?
【发布时间】:2021-02-23 07:58:53
【问题描述】:

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

澄清一下,我不是指lmplot()的函数参数,而是m
b 中的y = mx + b

【问题讨论】:

    标签: python seaborn linear-regression


    【解决方案1】:

    seaborn 使用 scipy stats linregress,因此您可以直接从那里获取。

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

    【讨论】:

    • 谢谢。从技术上讲,对于我所追求的基本最小二乘法,源代码使用 numpy 进行矩阵乘法,但您的回答仍然很有帮助。
    猜你喜欢
    • 2019-06-20
    • 1970-01-01
    • 2022-11-17
    • 2017-02-05
    • 2019-08-29
    • 2014-07-17
    • 2020-11-09
    • 2016-03-24
    • 1970-01-01
    相关资源
    最近更新 更多