参考文章: https://www.cnblogs.com/douzujun/p/8370657.html
https://blog.csdn.net/sxf1061926959/article/details/66976356?locationNum=9&fps=1
1、线性回归代码(使用矩阵运算求解系数)
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 15 22:02:02 2018
@author: xiaochenchen
"""
import numpy as np
import matplotlib.pyplot as plt
class LinearRegression():
def __init__(self):
self.W = None
def plotLine(self, w, b, xLow, xHigh):
x = np.arange(xLow, xHigh, 0.01)
y = w*x+b
plt.plot(x, y)
# x为变量矩阵, 每一行代表一条数据,
# x = [x1, x2, x3]
#