0
我正尝试使用graphlab创建线性回归模型。我有200个样本和1个预测器。但是,我遇到了“数字溢出错误”,下面是输出:graphlab线性回归由于数值溢出错误而终止
model_all = graphlab.linear_regression.create(data2.tail(200), target='output', features=['input'],validation_set=None,l2_penalty=0.0002,solver = 'auto')
Linear regression:
--------------------------------------------------------
Number of examples : 200
Number of features : 1
Number of unpacked features : 1
Number of coefficients : 2
Starting Newton Method
--------------------------------------------------------
+-----------+----------+--------------+--------------------+---------------+
| Iteration | Passes | Elapsed Time | Training-max_error | Training-rmse |
+-----------+----------+--------------+--------------------+---------------+
+-----------+----------+--------------+--------------------+---------------+
TERMINATED: Terminated due to numerical overflow error.
This model may not be ideal. To improve it, consider doing one of the following:
(a) Increasing the regularization.
(b) Standardizing the input data.
(c) Removing highly correlated features.
(d) Removing `inf` and `NaN` values in the training data
提示(二),(c)和(d),因为只有1个功能且没有INF并不适用于我的情况或NaN值。我尝试了各种l2_penalty,但都没有用。如果我将样本数量限制在一个较小的数字上,如180,那么它将起作用。
model_all = graphlab.linear_regression.create(data2.tail(180), target='output', features=['input'],validation_set=None,l2_penalty=0.0002,solver = 'auto')
model_all.get("coefficients").print_rows(num_rows=100)
Linear regression:
--------------------------------------------------------
Number of examples : 180
Number of features : 1
Number of unpacked features : 1
Number of coefficients : 2
Starting Newton Method
--------------------------------------------------------
+-----------+----------+--------------+--------------------+---------------+
| Iteration | Passes | Elapsed Time | Training-max_error | Training-rmse |
+-----------+----------+--------------+--------------------+---------------+
| 1 | 2 | 0.000866 | 9.873043 | 4.272624 |
+-----------+----------+--------------+--------------------+---------------+
SUCCESS: Optimal solution found.
+----------------+-------+------------------+-------------------+
| name | index | value | stderr |
+----------------+-------+------------------+-------------------+
| (intercept) | None | 9.3412783539 | 3.80166353756 |
| DOEDDIST.Index | None | 0.00226165438702 | 0.000975084975224 |
+----------------+-------+------------------+-------------------+
[2 rows x 4 columns]
我不明白是什么导致数值溢出错误。有人可以帮忙解释吗?
谢谢。
如果解决这个任务是你所需要的,你总是可以选择其他的求解器。为了调试,你可能应该显示数据,尽管你的观察结果确实很奇怪。 – sascha
感谢您的回复 – Pollyanna