Shingrace的个人博客分享 http://blog.sciencenet.cn/u/Shingrace

博文

python-拟合(一元线性)

已有 3392 次阅读 2016-12-16 13:53 |个人分类:python|系统分类:科研笔记| Python

def linear_model_main(xx,yy):

   regr = linear_model.LinearRegression()

   regr.fit(xx,yy)

   predictions = {}

   predictions['intercept']        = regr.intercept_          #截距

   predictions['coefficient']      = regr.coef_               #系数

   predictions['predicted_values'] = regr.predict(xx)         #预测值

   predictions['corrcoef']         = np.corrcoef(xx,yy)       #相关系数

   return predictions  




https://blog.sciencenet.cn/blog-669638-1021114.html

上一篇:python-符号运算(求导等)
下一篇:python-展开任意深度的list嵌套
收藏 IP: 159.226.234.*| 热度|

1 靳少非

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-22 04:03

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部