我正在读Logistic回归的documentation,遇到了一个混乱。尤其是,我对fit_intercept
和{
fit_intercept : bool, default: True
Specifies if a constant (a.k.a. bias or intercept) should be added to the decision function.
intercept_scaling : float, default 1.
Useful only when the solver
liblinear
is used andself.fit_intercept
is set toTrue
. In this case,x
becomes[x, self.intercept_scaling]
, i.e. a "synthetic" feature with constant value equal tointercept_scaling
is appended to the instance vector. The intercept becomesintercept_scaling * synthetic_feature_weight
.Note! the synthetic feature weight is subject to l1/l2 regularization as all other features. To lessen the effect of regularization on synthetic feature weight (and therefore on the intercept)
intercept_scaling
has to be increased.
据我所知,intercept作为数据集的一个虚拟特性,因为每次进行预测时,它都被添加到输出中。在
在intercept_scaling
下面的一段中,提到了-
a "synthetic" feature with constant value equal to intercept_scaling is appended to the instance vector
但这两个不是一回事吗?这是我的首要问题和困惑。在
最后,文档提到,只有当我使用liblinear
作为解算器时,这才有用。如果这两个确实是一样的,并且我将fit_intercept
作为{
fit_intercept
只是一个指令,告诉sklearn向决策函数添加一个截获。然而,由于截距必须被学习,那么synthetic_feature_weight
就会起作用,这基本上就是截获。intercept_scaling
在正则化中起作用,因为截距也会受到惩罚,所以通过增加intercept_scaling
给截距项更多的权重来抵消惩罚。在我没有找到任何理由来更改
intercept_scaling
参数,因为毕竟,截距将由算法学习,所以如果你甚至不知道截距是什么,那么为什么要缩放它的效果?在相关问题 更多 >
编程相关推荐