线性回归实例
1.导入工具包
import numpy as np
2.主体代码
#生成数据
#计算平均噪声loss
# y = wx + b
def compute_error_for_line_given_points(b, w, points):
totalError = 0
for i in range(0, len(points)):
x = points[i, 0]
y = points[i, 1]
totalError += (y - (w
原创
2020-12-21 23:06:09 ·
158 阅读 ·
0 评论