python多项式回归
Let’s start with an example. We want to predict the Price of a home based on the Area and Age. The function below was used to generate Home Prices and we can pretend this is “real-world data” and our “job” is to create a model which will predict the Price based on Area and Age:
让我们从一个例子开始。 我们想根据面积和年龄来预测房屋价格。 下面的函数用于生成房屋价格,我们可以假装这是“真实数据”,而我们的“工作”是创建一个模型,该模型将根据面积和年龄预测价格:
价格= -3 *面积-10 *年龄+ 0.033 *面积²-0.0000571 *面积³+ 500 (Price = -3*Area -10*Age + 0.033*Area² -0.0000571*Area³ + 500)
线性模型 (Linear Model)
Let’s suppose we just want to create a very simple Linear Regression model that predicts the Price using slope coefficients c1 and c2 and the y-intercept c0:
假设我们只想创建一个非常简单的线性回归模型,该模型使用斜率系数c1和c2以及y轴截距 c0来预测价格:
Price = c1*Area+c2*Age + c0
价格= c1 *面积+ c2 *年龄+ c0
We’ll l