首页 > 解决方案 > 我是否正确考虑了线性回归模型?

问题描述

我有以下模型:

<bound method Model.summary of Class                          : LinearRegression

Schema
------
Number of coefficients         : 18
Number of examples             : 21613
Number of feature columns      : 17
Number of unpacked features    : 17

Hyperparameters
---------------
L1 penalty                     : 10000000000.0
L2 penalty                     : 0.0

Training Summary
----------------
Solver                         : fista
Solver iterations              : 10
Solver status                  : Completed (Iteration limit reached).
Training time (sec)            : 1.2776

Settings
--------
Residual sum of squares        : 2842629034369063.5
Training RMSE                  : 364204.5762

Highest Positive Coefficients
-----------------------------
(intercept)                    : 274873.056
bathrooms                      : 8468.5311
grade                          : 842.068
sqft_living_sqrt               : 350.0606
sqft_living                    : 24.4207

Lowest Negative Coefficients
----------------------------
No Negative Coefficients       : 

这是否意味着我的等式将是:

预测 = 274873.056 + 8468.5311[浴室] + 842.068[等级]^2 + 350.0606[sqft_living_sqrt]^3 + 24.4207[sqft_living]^4

如果这是正确的,那么模型如何知道哪些特征属于 2 次方、3 次方等?如果我改变特征的顺序,系数会改变吗?

标签: linear-regression

解决方案


我不确定我是否使用 ^2 ... ^3... ^4.. 跟随您?RMSE 执行 ^2 ... ^2 ... ( 等等 )

这是 RMSE 所做的:

均方根误差

  1. 找出原始值和预测值之间的差异。
  2. 平方差异
  3. 将所有平方差相加
  4. 总和平均值
  5. 取平均值的平方根

你可以在这里看到我的例子 Math SE https://math.stackexchange.com/questions/3650442/simple-calculation-from-formula-rmse/3843518#3843518

只是,用 RMSE 公式替换您的值。并计算 RMSE。

问候,

//将要


推荐阅读