一、简单线性回归(SimpleLinearRegression)
b0源于下列公式:
b1来源于公式:
二、多元线性回归(MutipleLinearRegression)
运行结果:
[bug-01]
ValueError: Expected 2D array, got 1D array instead:
array=[102 6].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
解决办法:将array=[102 6].写成array=[[102,6]]
三、多元线性回归中自变量有[类别型]数据
车辆中有3种车型:
运行结果