human
I wrote the below code

    df = column_or_1d(df)
    y = column_or_1d(y)
    F = df
    tiny = np.finfo(np.float).tiny
    prior0 = float(np.sum((y <= 0)))
    prior1 = (y.shape[0] - prior0)
    T = np.zeros(y.shape)
    T[(y > 0)] = ((prior1 + 1.0) / (prior1 + 2.0))
    T[(y <= 0)] = (1.0 / (prior0 + 2.0))
    T1 = (1.0 - T)
    def objective(AB):
        E = np.exp(((AB[0] * F) + AB[1]))
        P = (1.0 / (1.0 + E))
        l = (- ((T * np.log((P + tiny))) + (T1 * np.log(((1.0 - P) + tiny)))))
        if (sample_weight is not None):
            return (sample_weight * l).sum()
        else:
            return l.sum()
    def grad(AB):
        E = np.exp(((AB[0] * F) + AB[1]))
        P = (1.0 / (1.0 + E))
        TEP_minus_T1P = (P * ((T * E) - T1))
        if (sample_weight is not None):
            TEP_minus_T1P *= sample_weight
        dA = np.dot(TEP_minus_T1P, F)
        dB = np.sum(TEP_minus_T1P)
        return np.array([dA, dB])
    AB0 = np.array([0.0, log(((prior0 + 1.0) / (prior1 + 1.0)))])
    AB_ = fmin_bfgs(objective, AB0, fprime=grad, disp=False)
    return (AB_[0], AB_[1])

What's a good function header?
assistant
#Here's a good function header.

def _sigmoid_calibration(df, y, sample_weight=None):