linear_regression.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:pyML 作者: tekrei 项目源码 文件源码
def linear_regression(x_vals, y_vals):
    '''
    least-squares regression of scipy
    '''
    a_value, b_value, r_value, p_value, std_err = linregress(x_vals, y_vals)
    est_yvals = a_value * x_vals + b_value
    k = 1 / a_value
    plot.plot(x_vals, est_yvals, label='Least-squares fit, k = ' +
              str(round(k)) + ", RSquare = " + str(r_value**2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号