MNT Simply gradient computation of sigmoid calibration
@@ -452,9 +452,8 @@ def _sigmoid_calibration(df, y, sample_weight=None):
def grad(AB):
# gradient of the objective function
- E = np.exp(AB[0] * F + AB[1])
- P = 1. / (1. + E)
- TEP_minus_T1P = P * (T * E - T1)
+ P = expit(-(AB[0] * F + AB[1]))
+ TEP_minus_T1P = T - P
if sample_weight is not None:
TEP_minus_T1P *= sample_weight
dA = np.dot(TEP_minus_T1P, F)
