📜  python 回归线 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:42.757000             🧑  作者: Mango

代码示例1
x = np.array([1, 2, 3, 4])
y = np.array([ 2, 8, 3, 6 ])

plt.plot(x, y, 'o')

m, b = np.polyfit(x, y, 1)
plt.plot(x, m*x + b)