'Make a single Newton-Raphson step.
our node estimate is given by:
sum(w * (y - prob)) / sum(w * prob * (1 - prob))
we take advantage that: y - prob = residual'

def _update_terminal_region(self, tree, terminal_regions, leaf, X, y, residual, pred, sample_weight):

    terminal_region = np.where((terminal_regions == leaf))[0]
    residual = residual.take(terminal_region, axis=0)
    y = y.take(terminal_region, axis=0)
    sample_weight = sample_weight.take(terminal_region, axis=0)
    numerator = np.sum((sample_weight * residual))
    denominator = np.sum(((sample_weight * (y - residual)) * ((1 - y) + residual)))
    if (abs(denominator) < 1e-150):
        tree.value[(leaf, 0, 0)] = 0.0
    else:
        tree.value[(leaf, 0, 0)] = (numerator / denominator)
